Skip to content

Commit d0e745d

Browse files
fabpotnicolas-grekas
authored andcommitted
Fix PHPUnit deprecations
1 parent 96fab32 commit d0e745d

File tree

6 files changed

+41
-44
lines changed

6 files changed

+41
-44
lines changed

.github/workflows/ci.yaml

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,22 @@ env:
1111

1212
jobs:
1313
tests:
14-
name: "PHP ${{ matrix.php-version }} + ${{ matrix.dependencies }}"
14+
name: "PHP ${{ matrix.php }} ${{ matrix.mode }}"
1515

1616
runs-on: ubuntu-latest
1717

1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
php-version:
22-
- '7.1'
23-
- '7.2'
24-
- '7.3'
25-
- '7.4'
26-
- '8.0'
27-
- '8.1'
28-
dependencies:
29-
- 'highest'
3021
include:
31-
- php-version: '7.1'
32-
dependencies: 'lowest'
22+
- php: '7.1'
23+
- php: '7.2'
24+
- php: '7.3'
25+
- php: '7.4'
26+
- php: '8.0'
27+
- php: '8.1'
28+
- php: '7.4'
29+
mode: low-deps
3330

3431
steps:
3532
- name: "Checkout code"
@@ -39,37 +36,37 @@ jobs:
3936
uses: shivammathur/[email protected]
4037
with:
4138
coverage: "none"
42-
php-version: ${{ matrix.php-version }}
39+
php-version: ${{ matrix.php }}
4340
tools: composer:v2
4441

4542
- name: "Validate composer.json"
4643
run: "composer validate --strict --no-check-lock"
4744

48-
- name: "Add PHPUnit matcher"
49-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
45+
- run: |
46+
composer require --no-update composer/composer:^1.0.2 --ansi
5047
51-
- run: composer require --no-update composer/composer:^1.0.2
52-
53-
- uses: "ramsey/composer-install@v1"
54-
with:
55-
dependency-versions: "${{ matrix.dependencies }}"
48+
if [[ "${{ matrix.mode }}" = low-deps ]]; then
49+
composer u --prefer-lowest --prefer-stable --ansi
50+
else
51+
composer u --ansi
52+
fi
5653
5754
- name: "Install PHPUnit"
5855
run: vendor/bin/simple-phpunit install
5956

60-
- name: "PHPUnit version"
61-
run: vendor/bin/simple-phpunit --version
62-
6357
- run: vendor/bin/simple-phpunit
6458

65-
- run: composer require --no-update composer/composer:^2
59+
- run: |
60+
composer require --no-update composer/composer:^2 --ansi
6661
67-
- uses: "ramsey/composer-install@v1"
68-
with:
69-
dependency-versions: "${{ matrix.dependencies }}"
62+
if [[ "${{ matrix.mode }}" = low-deps ]]; then
63+
composer u --prefer-lowest --prefer-stable --ansi
64+
else
65+
composer u --ansi
66+
fi
7067
7168
- run: vendor/bin/simple-phpunit
7269

73-
- if: matrix.php-version == '7.1'
70+
- if: matrix.php == '7.1'
7471
name: "Lint PHP files"
7572
run: find src/ -name '*.php' | xargs -n1 php -l

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"composer/composer": "^1.0.2|^2.0",
1919
"symfony/dotenv": "^4.4|^5.0",
2020
"symfony/filesystem": "^4.4|^5.0",
21-
"symfony/phpunit-bridge": "^4.4|^5.0",
21+
"symfony/phpunit-bridge": "^4.4.12|^5.0",
2222
"symfony/process": "^3.4|^4.4|^5.0"
2323
},
2424
"autoload": {

tests/Configurator/CopyDirectoryFromPackageConfiguratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testConfigureDirectory()
4444
}
4545

4646
foreach ($this->targetFiles as $targetFile) {
47-
$this->assertFileNotExists($targetFile);
47+
$this->assertFileDoesNotExist($targetFile);
4848
}
4949
$lock = $this->getMockBuilder(Lock::class)->disableOriginalConstructor()->getMock();
5050
$this->createConfigurator()->configure($this->recipe, [

tests/Configurator/CopyFromPackageConfiguratorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function testConfigure()
9494
$this->io->expects($this->at(1))->method('writeError')->with([' Created <fg=green>"./public/"</>']);
9595
$this->io->expects($this->at(2))->method('writeError')->with([' Created <fg=green>"./public/file"</>']);
9696

97-
$this->assertFileNotExists($this->targetFile);
97+
$this->assertFileDoesNotExist($this->targetFile);
9898
$lock = $this->getMockBuilder(Lock::class)->disableOriginalConstructor()->getMock();
9999
$this->createConfigurator()->configure($this->recipe, [$this->sourceFileRelativePath => $this->targetFileRelativePath], $lock);
100100
$this->assertFileExists($this->targetFile);
@@ -112,12 +112,12 @@ public function testUnconfigure()
112112
$this->assertFileExists($this->targetFile);
113113
$lock = $this->getMockBuilder(Lock::class)->disableOriginalConstructor()->getMock();
114114
$this->createConfigurator()->unconfigure($this->recipe, [$this->sourceFileRelativePath => $this->targetFileRelativePath], $lock);
115-
$this->assertFileNotExists($this->targetFile);
115+
$this->assertFileDoesNotExist($this->targetFile);
116116
}
117117

118118
public function testNoFilesRemoved()
119119
{
120-
$this->assertFileNotExists($this->targetFile);
120+
$this->assertFileDoesNotExist($this->targetFile);
121121
$this->io->expects($this->exactly(1))->method('writeError')->with([' Removing files from package']);
122122
$lock = $this->getMockBuilder(Lock::class)->disableOriginalConstructor()->getMock();
123123
$this->createConfigurator()->unconfigure($this->recipe, [$this->sourceFileRelativePath => $this->targetFileRelativePath], $lock);

tests/Configurator/CopyFromRecipeConfiguratorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function testConfigure()
8585
$this->io->expects($this->at(0))->method('writeError')->with([' Copying files from recipe']);
8686
$this->io->expects($this->at(1))->method('writeError')->with([' Created <fg=green>"./config/file"</>']);
8787

88-
$this->assertFileNotExists($this->targetFile);
88+
$this->assertFileDoesNotExist($this->targetFile);
8989
$lock = $this->getMockBuilder(Lock::class)->disableOriginalConstructor()->getMock();
9090
$this->createConfigurator()->configure(
9191
$this->recipe,
@@ -123,12 +123,12 @@ public function testUnconfigure()
123123
$this->assertFileExists($this->targetFile);
124124
$lock = $this->getMockBuilder(Lock::class)->disableOriginalConstructor()->getMock();
125125
$this->createConfigurator()->unconfigure($this->recipe, [$this->targetFileRelativePath], $lock);
126-
$this->assertFileNotExists($this->targetFile);
126+
$this->assertFileDoesNotExist($this->targetFile);
127127
}
128128

129129
public function testNoFilesRemoved()
130130
{
131-
$this->assertFileNotExists($this->targetFile);
131+
$this->assertFileDoesNotExist($this->targetFile);
132132
$this->io->expects($this->exactly(1))->method('writeError')->with([' Removing files from recipe']);
133133
$lock = $this->getMockBuilder(Lock::class)->disableOriginalConstructor()->getMock();
134134
$this->createConfigurator()->unconfigure($this->recipe, [$this->sourceFileRelativePath => $this->targetFileRelativePath], $lock);

tests/Configurator/EnvConfiguratorTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,19 +181,19 @@ public function testConfigureGeneratedSecret()
181181
], $lock);
182182

183183
$envContents = file_get_contents($env);
184-
$this->assertRegExp('/#TRUSTED_SECRET_1=[a-z0-9]{64}/', $envContents);
185-
$this->assertRegExp('/#TRUSTED_SECRET_2=[a-z0-9]{64}/', $envContents);
186-
$this->assertRegExp('/#TRUSTED_SECRET_3=[a-z0-9]{64}/', $envContents);
187-
$this->assertRegExp('/APP_SECRET=[a-z0-9]{32}/', $envContents);
184+
$this->assertMatchesRegularExpression('/#TRUSTED_SECRET_1=[a-z0-9]{64}/', $envContents);
185+
$this->assertMatchesRegularExpression('/#TRUSTED_SECRET_2=[a-z0-9]{64}/', $envContents);
186+
$this->assertMatchesRegularExpression('/#TRUSTED_SECRET_3=[a-z0-9]{64}/', $envContents);
187+
$this->assertMatchesRegularExpression('/APP_SECRET=[a-z0-9]{32}/', $envContents);
188188
@unlink($env);
189189

190190
foreach ([$phpunitDist, $phpunit] as $file) {
191191
$fileContents = file_get_contents($file);
192192

193-
$this->assertRegExp('/<!-- env name="TRUSTED_SECRET_1" value="[a-z0-9]{64}" -->/', $fileContents);
194-
$this->assertRegExp('/<!-- env name="TRUSTED_SECRET_2" value="[a-z0-9]{64}" -->/', $fileContents);
195-
$this->assertRegExp('/<!-- env name="TRUSTED_SECRET_3" value="[a-z0-9]{64}" -->/', $fileContents);
196-
$this->assertRegExp('/<env name="APP_SECRET" value="[a-z0-9]{32}"\/>/', $fileContents);
193+
$this->assertMatchesRegularExpression('/<!-- env name="TRUSTED_SECRET_1" value="[a-z0-9]{64}" -->/', $fileContents);
194+
$this->assertMatchesRegularExpression('/<!-- env name="TRUSTED_SECRET_2" value="[a-z0-9]{64}" -->/', $fileContents);
195+
$this->assertMatchesRegularExpression('/<!-- env name="TRUSTED_SECRET_3" value="[a-z0-9]{64}" -->/', $fileContents);
196+
$this->assertMatchesRegularExpression('/<env name="APP_SECRET" value="[a-z0-9]{32}"\/>/', $fileContents);
197197
}
198198
}
199199

0 commit comments

Comments
 (0)