Skip to content

Commit d0d4f42

Browse files
actions-userJoMessina
authored andcommitted
[rector] Rector fixes
1 parent 9ddb596 commit d0d4f42

File tree

7 files changed

+60
-33
lines changed

7 files changed

+60
-33
lines changed

.github/workflows/quality.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ jobs:
6060
uses: php-actions/phpstan@v3
6161
with:
6262
path: src/
63-
level: 4
63+
level: 3
6464
php_version: '8.2'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
/vendor/
33
bin/
44
.php-cs-fixer.cache
5+
.phpunit.result.cache
6+
.phpunit.cache/

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "library",
55
"require": {
66
"php": "^8.2",
7-
"phpunit/phpunit": "^10",
7+
"phpunit/phpunit": "^10.0",
88
"nikic/php-parser": "^4.10",
99
"php-etl/pipeline-contracts": "^0.3.0",
1010
"php-http/message": "^1.11",

composer.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

infection.json5

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/infection/infection/0.26.18/resources/schema.json",
3+
"source": {
4+
"directories": [
5+
"src"
6+
]
7+
},
8+
"timeout": 10,
9+
"logs": {
10+
"text": "infection.log",
11+
"summary": "summary.log",
12+
"json": "infection-log.json",
13+
"perMutator": "per-mutator.md",
14+
"github": true,
15+
},
16+
"phpUnit": {
17+
"configDir": "."
18+
},
19+
"mutators": {
20+
"@default": true
21+
},
22+
"testFramework":"phpunit",
23+
}

phpunit.xml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
<?xml version="1.0"?>
22
<phpunit
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
55
backupGlobals="true"
6-
backupStaticAttributes="false"
76
colors="false"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
forceCoversAnnotation="false"
127
processIsolation="false"
138
stopOnError="false"
149
stopOnFailure="false"
1510
stopOnIncomplete="false"
1611
stopOnSkipped="false"
1712
stopOnRisky="false"
18-
testSuiteLoaderClass="PHPUnit\Runner\StandardTestSuiteLoader"
1913
timeoutForSmallTests="1"
2014
timeoutForMediumTests="10"
2115
timeoutForLargeTests="60"
22-
verbose="false">
23-
<testsuites>
24-
<testsuite name="Functional tests">
25-
<directory>tests/functional/</directory>
26-
</testsuite>
27-
</testsuites>
28-
<php>
29-
<ini name="allow_url_include" value="1" />
30-
</php>
16+
cacheDirectory=".phpunit.cache"
17+
backupStaticProperties="false"
18+
requireCoverageMetadata="false">
19+
<testsuites>
20+
<testsuite name="Functional tests">
21+
<directory>tests/functional/</directory>
22+
</testsuite>
23+
</testsuites>
24+
<coverage>
25+
<include>
26+
<directory suffix=".php">src</directory>
27+
</include>
28+
</coverage>
29+
<php>
30+
<ini name="allow_url_include" value="1"/>
31+
</php>
3132
</phpunit>

tests/functional/Constraint/Pipeline/IteratesLikeTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
namespace functional\Constraint\Pipeline;
44

55
use Kiboko\Component\PHPUnitExtension\Constraint\Pipeline\IteratesLike;
6+
use PHPUnit\Framework\Attributes\DataProvider;
67
use PHPUnit\Framework\Constraint\IsEqual;
78
use PHPUnit\Framework\Constraint\LogicalNot;
89
use PHPUnit\Framework\TestCase;
910

1011
final class IteratesLikeTest extends TestCase
1112
{
12-
private $fixtures = <<<JSON
13+
private static string $fixtures = <<<JSON
1314
{"firstName":"Margot","lastName":"Lamy","email":"[email protected]","address":"39, chemin Huet\\r\\n76 185 Gomez","postcode":"84 138","city":"Legrand"}
1415
{"firstName":"Dominique","lastName":"Garnier","email":"[email protected]","address":"46, chemin de Hernandez\\r\\n52 853 Munoz","postcode":"95 866","city":"BuissonBourg"}
1516
{"firstName":"Mich\\u00e8le","lastName":"Martins","email":"[email protected]","address":"374, rue de Gauthier\\r\\n82315 LaineBourg","postcode":"89 150","city":"Aubry"}
@@ -80,22 +81,22 @@ final class IteratesLikeTest extends TestCase
8081
{"firstName":"No\\u00e9mi","lastName":"Guillaume","email":"[email protected]","address":"757, rue Mich\\u00e8le Gay\\r\\n65212 Leroux","postcode":"95030","city":"Ruiz"}
8182
JSON;
8283

83-
private function fromJSONStream(string $source): iterable
84+
private static function fromJSONStream(string $source): iterable
8485
{
8586
$file = new \SplFileObject('php://temp', 'r+');
8687
$file->fwrite($source);
8788
$file->fseek(0, SEEK_SET);
8889

8990
while (!$file->eof()) {
90-
yield \json_decode($file->fgets(), true);
91+
yield \json_decode($file->fgets(), true, 512, JSON_THROW_ON_ERROR);
9192
}
9293
}
9394

94-
public function successfulDataProvider()
95+
public static function successfulDataProvider(): \Generator
9596
{
9697
yield [
97-
$this->fromJSONStream($this->fixtures),
98-
$this->fromJSONStream($this->fixtures),
98+
IteratesLikeTest::fromJSONStream(self::$fixtures),
99+
IteratesLikeTest::fromJSONStream(self::$fixtures),
99100
];
100101

101102
yield [
@@ -104,7 +105,7 @@ public function successfulDataProvider()
104105
];
105106
}
106107

107-
/** @dataProvider successfulDataProvider */
108+
#[DataProvider('successfulDataProvider')]
108109
public function testExtractionSucceeds(iterable $expected, iterable $actual)
109110
{
110111
$constraint = new IteratesLike($expected, fn ($value) => new IsEqual($value));
@@ -114,7 +115,7 @@ public function testExtractionSucceeds(iterable $expected, iterable $actual)
114115

115116
public function testExtractionFails()
116117
{
117-
$constraint = new IteratesLike($this->fromJSONStream($this->fixtures), fn ($value) => new LogicalNot(new IsEqual($value)));
118+
$constraint = new IteratesLike(IteratesLikeTest::fromJSONStream(self::$fixtures), fn ($value) => new LogicalNot(new IsEqual($value)));
118119

119120
$this->assertThat([], $constraint);
120121
}

0 commit comments

Comments
 (0)