Skip to content

Commit 9fcb3c5

Browse files
authored
Merge pull request #154 from spatie/v5
v5 - add support for PHPUnit v10
2 parents e472fe4 + 313350f commit 9fcb3c5

19 files changed

+59
-133
lines changed

.github/workflows/php-cs-fixer.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/pint.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Check & fix styling
2+
3+
on: [push]
4+
5+
jobs:
6+
php-cs-fixer:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v3
12+
with:
13+
ref: ${{ github.head_ref }}
14+
15+
- name: Fix styling issues
16+
uses: aglipanci/laravel-pint-action@0.1.0
17+
18+
- name: Commit changes
19+
uses: stefanzweifel/git-auto-commit-action@v4
20+
with:
21+
commit_message: Fix styling

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
fail-fast: true
1010
matrix:
1111
os: [ubuntu-latest, windows-latest]
12-
php: [8.2, 8.1, 8.0, 7.4, 7.3]
12+
php: [8.2, 8.1]
1313
stability: [prefer-lowest, prefer-stable]
1414

1515
name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
.idea
2-
.php-cs-fixer.cache
3-
.phpunit.result.cache
4-
build
1+
.phpunit.cache
52
composer.lock
63
coverage
74
docs

.php-cs-fixer.dist.php

Lines changed: 0 additions & 40 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ Snapshot ids are generated via the `getSnapshotId` method on the `MatchesSnapsho
188188
protected function getSnapshotId(): string
189189
{
190190
return (new ReflectionClass($this))->getShortName().'--'.
191-
$this->getName().'--'.
191+
$this->name().'--'.
192192
$this->snapshotIncrementor;
193193
}
194194
```

composer.json

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,15 @@
2020
}
2121
],
2222
"require": {
23-
"php": "^7.3|^7.4|^8.0",
23+
"php": "^8.1",
2424
"ext-dom": "*",
2525
"ext-json": "*",
2626
"ext-libxml": "*",
2727
"composer-runtime-api": "^2.0",
28-
"phpunit/phpunit": "^8.3|^9.0",
29-
"symfony/property-access": "^4.0|^5.0|^6.0",
30-
"symfony/serializer": "^4.0|^5.0|^6.0",
31-
"symfony/yaml": "^4.0|^5.0|^6.0"
32-
},
33-
"require-dev": {
34-
"phpunit/phpunit": "^9.1.0"
28+
"phpunit/phpunit": "^10.0",
29+
"symfony/property-access": "^5.2|^6.2",
30+
"symfony/serializer": "^5.2|^6.2",
31+
"symfony/yaml": "^5.2|^6.2"
3532
},
3633
"autoload": {
3734
"psr-4": {
@@ -48,5 +45,12 @@
4845
},
4946
"config": {
5047
"sort-packages": true
51-
}
48+
},
49+
"minimum-stability": "dev",
50+
"prefer-stable": true,
51+
"extra": {
52+
"branch-alias": {
53+
"dev-v5": "5.0-dev"
54+
}
55+
}
5256
}

phpunit.xml.dist

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
<coverage>
4-
<include>
5-
<directory suffix=".php">src/</directory>
6-
</include>
7-
<report>
8-
<clover outputFile="build/logs/clover.xml"/>
9-
<html outputDirectory="build/coverage"/>
10-
<text outputFile="build/coverage.txt"/>
11-
</report>
12-
</coverage>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
133
<testsuites>
144
<testsuite name="Integration">
155
<directory>tests/Integration</directory>

src/Concerns/SnapshotIdAware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trait SnapshotIdAware
1313
protected function getSnapshotId(): string
1414
{
1515
return (new ReflectionClass($this))->getShortName().'__'.
16-
$this->getName().'__'.
16+
$this->name().'__'.
1717
$this->snapshotIncrementor;
1818
}
1919
}

src/Driver.php

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,22 @@
44

55
interface Driver
66
{
7-
/**
7+
/*
88
* Serialize a snapshot's data to a string that can be written to a
99
* generated snapshot file.
10-
*
11-
* @param mixed $data
12-
*
13-
* @return string
1410
*/
15-
public function serialize($data): string;
11+
public function serialize(mixed $data): string;
1612

17-
/**
13+
/*
1814
* The extension that should be used to save the snapshot file, without
1915
* a leading dot.
20-
*
21-
* @return string
2216
*/
2317
public function extension(): string;
2418

25-
/**
19+
/*
2620
* Match an expectation with a snapshot's actual contents. Should throw an
2721
* `ExpectationFailedException` if it doesn't match. This happens by
2822
* default if you're using PHPUnit's `Assert` class for the match.
29-
*
30-
* @param mixed $expected
31-
* @param mixed $actual
32-
*
33-
* @throws \PHPUnit\Framework\ExpectationFailedException
3423
*/
35-
public function match($expected, $actual);
24+
public function match(mixed $expected, mixed $actual);
3625
}

0 commit comments

Comments
 (0)