Skip to content

Commit 5854972

Browse files
authored
Add test for config_update and fix missing dependency (#217)
1 parent b73fc8a commit 5854972

File tree

4 files changed

+116
-57
lines changed

4 files changed

+116
-57
lines changed

Diff for: .github/workflows/php.yml

+60-3
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,16 @@ jobs:
4545
run: "php vendor/bin/phpcs src"
4646
# - name: "PHPStan"
4747
# run: "php vendor/bin/phpstan analyze src"
48+
- name: Remove vendor directory for integration testing
49+
run: rm -rf vendor
4850
- name: Setup Drupal
4951
run: |
5052
COMPOSER_MEMORY_LIMIT=-1 composer create-project drupal/recommended-project:${{ matrix.drupal }} ~/drupal --no-interaction
5153
cd ~/drupal
5254
composer config minimum-stability dev
5355
composer config prefer-stable true
5456
composer config preferred-install dist
55-
composer config repositories.0 path $GITHUB_WORKSPACE
57+
composer config repositories.0 "{\"type\": \"path\", \"url\": \"$GITHUB_WORKSPACE\", \"options\": {\"symlink\": false}}"
5658
composer config repositories.1 composer https://packages.drupal.org/8
5759
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/core-dev:${{ matrix.drupal }} --with-all-dependencies
5860
- name: "Add phpspec/prophecy-phpunit"
@@ -67,8 +69,63 @@ jobs:
6769
- name: "Analyze core/install.php"
6870
run: |
6971
cd ~/drupal
70-
./vendor/bin/drupal-check web/core/install.php
72+
./vendor/bin/drupal-check -vvv web/core/install.php
7173
- name: "Analyze dynamic_page_cache"
7274
run: |
7375
cd ~/drupal
74-
./vendor/bin/drupal-check web/core/modules/dynamic_page_cache || if (($? == 255)); then false; else true; fi
76+
./vendor/bin/drupal-check -vvv web/core/modules/dynamic_page_cache || if (($? == 255)); then false; else true; fi
77+
78+
contrib:
79+
runs-on: "ubuntu-latest"
80+
name: "${{ matrix.project }} | PHP ${{ matrix.php-version }} | Drupal ${{ matrix.drupal }}"
81+
strategy:
82+
matrix:
83+
include:
84+
- php-version: "7.3"
85+
drupal: "~8.9"
86+
project: config_update
87+
additional_projects: ''
88+
type: module
89+
- php-version: "7.3"
90+
drupal: "~8.9"
91+
project: blazy
92+
additional_projects: 'drupal/token drupal/ctools'
93+
type: module
94+
steps:
95+
- name: "Checkout"
96+
uses: "actions/checkout@v2"
97+
- name: "Install PHP"
98+
uses: "shivammathur/setup-php@v2"
99+
with:
100+
coverage: "none"
101+
php-version: "${{ matrix.php-version }}"
102+
tools: composer:v2
103+
extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, bcmath, gd, exif, iconv
104+
- name: Setup Drupal
105+
run: |
106+
COMPOSER_MEMORY_LIMIT=-1 composer create-project drupal/recommended-project:${{ matrix.drupal }} ~/drupal --no-interaction
107+
cd ~/drupal
108+
composer config minimum-stability dev
109+
composer config prefer-stable true
110+
composer config preferred-install dist
111+
composer config repositories.0 "{\"type\": \"path\", \"url\": \"$GITHUB_WORKSPACE\", \"options\": {\"symlink\": false}}"
112+
composer config repositories.1 composer https://packages.drupal.org/8
113+
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/core-dev:${{ matrix.drupal }} --with-all-dependencies
114+
- name: "Add phpspec/prophecy-phpunit"
115+
run: |
116+
cd ~/drupal
117+
COMPOSER_MEMORY_LIMIT=-1 composer require --dev phpspec/prophecy-phpunit:^2
118+
if: ${{ matrix.drupal == '^9.0' }}
119+
- name: "require drupal-check"
120+
run: |
121+
cd ~/drupal
122+
COMPOSER_MEMORY_LIMIT=-1 composer require mglaman/drupal-check *@dev
123+
- name: "verify drupal-check version"
124+
run: |
125+
cd ~/drupal
126+
./vendor/bin/drupal-check --version
127+
- name: 'Check ${{ matrix.project }}'
128+
run: |
129+
cd ~/drupal
130+
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/${{ matrix.project }} ${{ matrix.additional_projects }}
131+
./vendor/bin/drupal-check -vvv web/${{ matrix.type }}s/contrib/${{ matrix.project }} --no-progress || if (($? == 255 || $? == 127)); then false; else true; fi

Diff for: composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
"jean85/pretty-package-versions": "^1.5.0 || ^2.0.1",
1616
"mglaman/phpstan-drupal": "^0.12.8",
1717
"nette/neon": "^3.1",
18+
"phpstan/phpstan-deprecation-rules": "^0.12.6",
1819
"symfony/console": "~3.2 || ~4.0",
1920
"symfony/process": "~3.2 || ~4.0",
2021
"webflo/drupal-finder": "^1.1"
2122
},
2223
"require-dev": {
2324
"phpstan/phpstan": "^0.12.81",
24-
"phpstan/phpstan-deprecation-rules": "^0.12.6",
2525
"phpstan/phpstan-strict-rules": "^0.12.9",
2626
"squizlabs/php_codesniffer": "^3.4"
2727
},

Diff for: composer.lock

+52-52
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/Command/CheckCommand.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace DrupalCheck\Command;
44

5-
use DrupalCheck\Util\Tty;
65
use DrupalFinder\DrupalFinder;
76
use Nette\Neon\Neon;
87
use PHPStan\ShouldNotHappenException;
@@ -179,6 +178,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
179178
$pharPath = \Phar::running();
180179
if ($pharPath !== '') {
181180
// Running in packaged Phar archive.
181+
$output->writeln('<comment>Assumed running as Phar</comment>', OutputInterface::VERBOSITY_DEBUG);
182182
$phpstanBin = \realpath('vendor/phpstan/phpstan/phpstan.phar');
183183
$configuration_data['parameters']['bootstrapFiles'] = [\realpath($pharPath . '/error-bootstrap.php')];
184184
$configuration_data['includes'] = [
@@ -187,6 +187,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
187187
];
188188
} elseif (file_exists(__DIR__ . '/../../vendor/autoload.php')) {
189189
// Running as a project dependency.
190+
$output->writeln('<comment>Assumed running as local dependency</comment>', OutputInterface::VERBOSITY_DEBUG);
190191
$phpstanBin = \realpath(__DIR__ . '/../../vendor/phpstan/phpstan/phpstan.phar');
191192
$configuration_data['parameters']['bootstrapFiles'] = [\realpath(__DIR__ . '/../../error-bootstrap.php')];
192193
$configuration_data['includes'] = [
@@ -195,6 +196,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
195196
];
196197
} elseif (file_exists(__DIR__ . '/../../../../autoload.php')) {
197198
// Running as a global dependency.
199+
$output->writeln('<comment>Assumed running as global dependency</comment>', OutputInterface::VERBOSITY_DEBUG);
198200
$phpstanBin = \realpath(__DIR__ . '/../../../../phpstan/phpstan/phpstan.phar');
199201
$configuration_data['parameters']['bootstrapFiles'] = [\realpath(__DIR__ . '/../../error-bootstrap.php')];
200202
// The phpstan/extension-installer doesn't seem to register.

0 commit comments

Comments
 (0)