Skip to content

Commit 4617172

Browse files
chore: upgrade PHPUnit to ^11||^12 (#106)
- Update composer.json to require PHPUnit ^11||^12 - Migrate phpunit.xml.dist to PHPUnit 12 schema - Update HarTest to use PHP attributes for data provider (required for PHPUnit 10+) - Add .phpunit.cache to .gitignore Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2241b8d commit 4617172

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
composer.lock
22
build
33
.phpunit.result.cache
4+
.phpunit.cache
45
vendor
56
.php-cs-fixer.cache
67
har.phar

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"require-dev": {
2525
"friendsofphp/php-cs-fixer": "3.92.0",
26-
"phpunit/phpunit": "^9.5",
26+
"phpunit/phpunit": "^11||^12",
2727
"guzzlehttp/guzzle": "^7.0"
2828
},
2929
"autoload": {

phpunit.xml.dist

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
<coverage processUncoveredFiles="true">
4-
<include>
5-
<directory suffix=".php">./src</directory>
6-
</include>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3+
<coverage>
74
<report>
85
<clover outputFile="build/logs/clover.xml"/>
96
</report>
@@ -16,4 +13,9 @@
1613
<logging>
1714
<junit outputFile="build/logs/results.xml"/>
1815
</logging>
16+
<source>
17+
<include>
18+
<directory suffix=".php">./src</directory>
19+
</include>
20+
</source>
1921
</phpunit>

tests/src/Unit/HarTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
use Deviantintegral\Har\Har;
99
use Deviantintegral\Har\Log;
1010
use Deviantintegral\Har\Serializer;
11+
use PHPUnit\Framework\Attributes\DataProvider;
1112

1213
class HarTest extends HarTestBase
1314
{
1415
/**
1516
* Tests deserializing and reserializing a complete HAR file.
16-
*
17-
* @dataProvider fixtureDataProvider
1817
*/
18+
#[DataProvider('fixtureDataProvider')]
1919
public function testExportedFixture(string $id, Har $har)
2020
{
2121
$repository = $this->getHarFileRepository();
@@ -28,9 +28,9 @@ public function testExportedFixture(string $id, Har $har)
2828
$this->assertEquals($jsonDecode, json_decode($serialized, true));
2929
}
3030

31-
public function fixtureDataProvider()
31+
public static function fixtureDataProvider()
3232
{
33-
$repository = $this->getHarFileRepository();
33+
$repository = new \Deviantintegral\Har\Repository\HarFileRepository(__DIR__.'/../../fixtures');
3434

3535
foreach ($repository->loadMultiple() as $id => $har) {
3636
yield [$id, $har];

0 commit comments

Comments
 (0)