Skip to content

Commit 0296561

Browse files
committed
Fix: Use separate PHPT tests for lowest and highest versions of phpunit/phpunit
1 parent bf575ea commit 0296561

File tree

23 files changed

+266
-30
lines changed

23 files changed

+266
-30
lines changed

.github/workflows/integrate.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -762,35 +762,35 @@ jobs:
762762
763763
- name: "Run end-to-end tests with phpunit/phpunit:6.5.0"
764764
if: "matrix.phpunit-version == '6.5.0'"
765-
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version06/phpunit.xml"
765+
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version06/phpunit.xml --testsuite=${{ matrix.dependencies }}"
766766

767767
- name: "Run end-to-end tests with phpunit/phpunit:7.5.0"
768768
if: "matrix.phpunit-version == '7.5.0'"
769-
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version07/phpunit.xml"
769+
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version07/phpunit.xml --testsuite=${{ matrix.dependencies }}"
770770

771771
- name: "Run end-to-end tests with phpunit/phpunit:8.5.19"
772772
if: "matrix.phpunit-version == '8.5.19'"
773-
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version08/phpunit.xml"
773+
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version08/phpunit.xml --testsuite=${{ matrix.dependencies }}"
774774

775775
- name: "Run end-to-end tests with phpunit/phpunit:8.5.40"
776776
if: "matrix.phpunit-version == '8.5.40'"
777-
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version08/phpunit.xml"
777+
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version08/phpunit.xml --testsuite=${{ matrix.dependencies }}"
778778

779779
- name: "Run end-to-end tests with phpunit/phpunit:9.0.0"
780780
if: "matrix.phpunit-version == '9.0.0'"
781-
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version09/phpunit.xml"
781+
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version09/phpunit.xml --testsuite=${{ matrix.dependencies }}"
782782

783783
- name: "Run end-to-end tests with phpunit/phpunit:10.0.0"
784784
if: "matrix.phpunit-version == '10.0.0'"
785-
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version10/phpunit.xml"
785+
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version10/phpunit.xml --testsuite=${{ matrix.dependencies }}"
786786

787787
- name: "Run end-to-end tests with phpunit/phpunit:11.0.0"
788788
if: "matrix.phpunit-version == '11.0.0'"
789-
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version11/phpunit.xml"
789+
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version11/phpunit.xml --testsuite=${{ matrix.dependencies }}"
790790

791791
- name: "Run end-to-end tests with phpunit/phpunit:12.0.0"
792792
if: "matrix.phpunit-version == '12.0.0'"
793-
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version12/phpunit.xml"
793+
run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version12/phpunit.xml --testsuite=${{ matrix.dependencies }}"
794794

795795
- name: "Download Phar"
796796
uses: "actions/[email protected]"

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ static-code-analysis-baseline: vendor ## Generates a baseline for static code an
5454
tests: phar ## Runs unit, end-to-end, and phar tests with phpunit/phpunit on PHP 7.4
5555
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^6.5.0 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/Unit/phpunit.xml; git checkout HEAD -- composer.json composer.lock
5656

57-
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^6.5.0 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/EndToEnd/Version06/phpunit.xml; git checkout HEAD -- composer.json composer.lock
58-
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^7.5.0 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/EndToEnd/Version07/phpunit.xml; git checkout HEAD -- composer.json composer.lock
59-
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^8.5.19 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/EndToEnd/Version08/phpunit.xml; git checkout HEAD -- composer.json composer.lock
60-
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^9.0.0 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/EndToEnd/Version09/phpunit.xml; git checkout HEAD -- composer.json composer.lock
57+
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^6.5.0 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/EndToEnd/Version06/phpunit.xml --test-suite=highest; git checkout HEAD -- composer.json composer.lock
58+
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^7.5.0 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/EndToEnd/Version07/phpunit.xml --test-suite=highest; git checkout HEAD -- composer.json composer.lock
59+
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^8.5.19 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/EndToEnd/Version08/phpunit.xml --test-suite=highest; git checkout HEAD -- composer.json composer.lock
60+
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^9.0.0 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/EndToEnd/Version09/phpunit.xml --test-suite=highest; git checkout HEAD -- composer.json composer.lock
6161

62-
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^6.5.0 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/Phar/Version06/phpunit.xml; git checkout HEAD -- composer.json composer.lock
63-
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^7.5.0 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/Phar/Version07/phpunit.xml; git checkout HEAD -- composer.json composer.lock
64-
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^8.5.19 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/Phar/Version08/phpunit.xml; git checkout HEAD -- composer.json composer.lock
65-
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^9.0.0 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/Phar/Version09/phpunit.xml; git checkout HEAD -- composer.json composer.lock
62+
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^6.5.0 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/Phar/Version06/phpunit.xml --test-suite=highest; git checkout HEAD -- composer.json composer.lock
63+
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^7.5.0 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/Phar/Version07/phpunit.xml --test-suite=highest; git checkout HEAD -- composer.json composer.lock
64+
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^8.5.19 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/Phar/Version08/phpunit.xml --test-suite=highest; git checkout HEAD -- composer.json composer.lock
65+
composer config platform.php --unset && composer remove ergebnis/php-cs-fixer-config phpstan/phpstan-phpunit --dev --no-interaction --quiet && composer require phpunit/phpunit:^9.0.0 --no-interaction --quiet --update-with-all-dependencies && vendor/bin/phpunit --configuration=test/Phar/Version09/phpunit.xml --test-suite=highest; git checkout HEAD -- composer.json composer.lock
6666

6767
vendor: composer.json composer.lock
6868
composer validate --strict
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
With a test case that does not sleep in methods that are not test methods
3+
--FILE--
4+
<?php
5+
6+
declare(strict_types=1);
7+
8+
use PHPUnit\TextUI;
9+
10+
$_SERVER['argv'][] = '--configuration=test/EndToEnd/Version06/TestCase/Bare/phpunit.xml';
11+
12+
require_once __DIR__ . '/../../../../../vendor/autoload.php';
13+
14+
PHPUnit\TextUI\Command::main();
15+
--EXPECTF--
16+
PHPUnit %s
17+
18+
Runtime: %s
19+
Configuration: %s/EndToEnd/Version06/TestCase/Bare/phpunit.xml
20+
21+
... 3 / 3 (100%)
22+
23+
Detected 2 tests where the duration exceeded the maximum duration.
24+
25+
1. 00:00.3%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version06\TestCase\Bare\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider with data set #1
26+
2. 00:00.2%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version06\TestCase\Bare\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider with data set #0
27+
28+
Time: %s, Memory: %s
29+
30+
OK (3 tests, 3 assertions)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
With a test case that sleeps in data provider, hook, and test methods
3+
--FILE--
4+
<?php
5+
6+
declare(strict_types=1);
7+
8+
use PHPUnit\TextUI;
9+
10+
$_SERVER['argv'][] = '--configuration=test/EndToEnd/Version06/TestCase/Combination/phpunit.xml';
11+
12+
require_once __DIR__ . '/../../../../../vendor/autoload.php';
13+
14+
PHPUnit\TextUI\Command::main();
15+
--EXPECTF--
16+
PHPUnit %s
17+
18+
Runtime: %s
19+
Configuration: %s/EndToEnd/Version06/TestCase/Combination/phpunit.xml
20+
21+
... 3 / 3 (100%)
22+
23+
Detected 3 tests where the duration exceeded the maximum duration.
24+
25+
1. 00:00.9%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version06\TestCase\Combination\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider with data set #1
26+
2. 00:00.8%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version06\TestCase\Combination\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider with data set #0
27+
3. 00:00.6%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version06\TestCase\Combination\SleeperTest::testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration
28+
29+
Time: %s, Memory: %s
30+
31+
OK (3 tests, 3 assertions)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
With a test case that sleeps in a method with @after annotation
3+
--FILE--
4+
<?php
5+
6+
declare(strict_types=1);
7+
8+
use PHPUnit\TextUI;
9+
10+
$_SERVER['argv'][] = '--configuration=test/EndToEnd/Version06/TestCase/WithAfterAnnotation/phpunit.xml';
11+
12+
require_once __DIR__ . '/../../../../../vendor/autoload.php';
13+
14+
PHPUnit\TextUI\Command::main();
15+
--EXPECTF--
16+
PHPUnit %s
17+
18+
Runtime: %s
19+
Configuration: %s/EndToEnd/Version06/TestCase/WithAfterAnnotation/phpunit.xml
20+
21+
... 3 / 3 (100%)
22+
23+
Detected 3 tests where the duration exceeded the maximum duration.
24+
25+
1. 00:00.4%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version06\TestCase\WithAfterAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider with data set #1
26+
2. 00:00.3%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version06\TestCase\WithAfterAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider with data set #0
27+
3. 00:00.1%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version06\TestCase\WithAfterAnnotation\SleeperTest::testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration
28+
29+
Time: %s, Memory: %s
30+
31+
OK (3 tests, 3 assertions)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
With a test case that sleeps in a method with @afterClass annotation
3+
--FILE--
4+
<?php
5+
6+
declare(strict_types=1);
7+
8+
use PHPUnit\TextUI;
9+
10+
$_SERVER['argv'][] = '--configuration=test/EndToEnd/Version06/TestCase/WithAfterClassAnnotation/phpunit.xml';
11+
12+
require_once __DIR__ . '/../../../../../vendor/autoload.php';
13+
14+
PHPUnit\TextUI\Command::main();
15+
--EXPECTF--
16+
PHPUnit %s
17+
18+
Runtime: %s
19+
Configuration: %s/EndToEnd/Version06/TestCase/WithAfterClassAnnotation/phpunit.xml
20+
21+
... 3 / 3 (100%)
22+
23+
Detected 2 tests where the duration exceeded the maximum duration.
24+
25+
1. 00:00.3%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version06\TestCase\WithAfterClassAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider with data set #1
26+
2. 00:00.2%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version06\TestCase\WithAfterClassAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider with data set #0
27+
28+
Time: %s, Memory: %s
29+
30+
OK (3 tests, 3 assertions)

0 commit comments

Comments
 (0)