Skip to content

Update to phpunit ^10 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
prefer_lowest: ["", "--prefer-lowest"]
container:
image: skpr/php-cli:8.3-dev-v2-latest
image: skpr/php-cli:8.4-dev-v2-latest
options:
--pull always
--user 1001:1001
Expand All @@ -31,7 +31,7 @@ jobs:
- name: 🧹 PHPCS
run: ./bin/phpcs --report=checkstyle -q | ./bin/cs2pr
- name: 🧹 PHPStan
run: ./bin/phpstan --error-format=github analyse
run: ./bin/phpstan --error-format=github analyse -v
- name: ⚡ Run Tests
run: ./bin/phpunit --log-junit phpunit-results.xml
- name: 📝 Publish Test Results
Expand Down
37 changes: 28 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
{
"name": "previousnext/phpunit-splitter",
"description": "Splits phpunit tests",
"keywords": ["testing"],
"keywords": ["testing", "phpunit"],
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "Michael Strelan",
"email": "[email protected]"
},
{
"name": "Kim Pepper",
"email": "[email protected]"
}
],
"type": "project",
"require": {
"php": "^8.1",
"ext-simplexml": "*",
"symfony/console": "^6.3|^7.0"
"phpstan/phpstan-deprecation-rules": "^1.2",
"phpstan/phpstan-phpunit": "^1.4",
"symfony/console": "^6.3|^7.2"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.6",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^1.12.19",
"phpunit/phpunit": "^10.5.45",
"previousnext/coding-standard": "^1.1.1",
"staabm/annotate-pull-request-from-checkstyle": "^1.8"
},
"bin" : ["phpunit-splitter"],
"conflict": {
"drupal/coder": "<8.3.21"
},
"bin": ["phpunit-splitter"],
"autoload": {
"psr-4": {"PhpUnitSplitter\\": "src/"}
},
Expand All @@ -39,7 +43,22 @@
"sort-packages": true,
"bin-dir": "bin",
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
}
},
"scripts": {
"phpcs": [
"phpcs"
],
"phpcbf": [
"phpcbf"
],
"phpstan": [
"phpstan analyse --no-progress -v"
],
"phpunit": [
"phpunit"
]
}
}
18 changes: 7 additions & 11 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
cacheDirectory=".phpunit.cache"
executionOrder="depends,defects"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
verbose="true">
requireCoverageMetadata="true"
beStrictAboutCoverageMetadata="true"
>
<testsuites>
<testsuite name="default">
<directory>tests/src</directory>
</testsuite>
</testsuites>

<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion src/GlobbingTestResultCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(
* {@inheritdoc}
*/
public function getState(string $testName): int {
return $this->defects[$testName] ?? TestStatus::UNKNOWN->getValue();
return $this->defects[$testName] ?? TestStatus::Unknown->getValue();
}

/**
Expand Down
16 changes: 8 additions & 8 deletions src/TestStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
*/
enum TestStatus: int {

case UNKNOWN = -1;
case PASSED = 0;
case SKIPPED = 1;
case INCOMPLETE = 2;
case FAILURE = 3;
case ERROR = 4;
case RISKY = 5;
case WARNING = 6;
case Unknown = -1;
case Passed = 0;
case Skipped = 1;
case Incomplete = 2;
case Failure = 3;
case Error = 4;
case Risky = 5;
case Warning = 6;

/**
* Get the status value.
Expand Down