From 000e4ad121013d3a1993dda59519fa3282f41b77 Mon Sep 17 00:00:00 2001 From: Edward Surov Date: Fri, 10 Nov 2023 16:53:54 +0200 Subject: [PATCH] versioning workarounds in pipeline --- .github/workflows/build.yml | 12 ++++++++++-- composer.json | 23 +++++++++++++++++++++++ phpunit.10.0.report.xml | 25 +++++++++++++++++++++++++ phpunit.10.0.xml | 23 +++++++++++++++++++++++ phpunit.report.xml | 8 +++++++- phpunit.xml.dist | 17 +++++++++++++---- test/report/Generate/NegativeTest.php | 22 +++++++--------------- test/unit/Event/EventTestTrait.php | 1 + 8 files changed, 109 insertions(+), 22 deletions(-) create mode 100644 phpunit.10.0.report.xml create mode 100644 phpunit.10.0.xml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ecd4d9f..539bf73 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,9 +49,17 @@ jobs: ${{ matrix.composer-options }} - name: Run tests - if: ${{ matrix.os != 'windows-latest' }} + if: ${{ matrix.os != 'windows-latest' && !contains(matrix.composer-options, '--prefer-lowest') }} run: composer test + - name: Run tests (lowest) + if: ${{ matrix.os != 'windows-latest' && contains(matrix.composer-options, '--prefer-lowest') }} + run: composer test-lowest + - name: Run tests (windows) - if: ${{ matrix.os == 'windows-latest' }} + if: ${{ matrix.os == 'windows-latest' && !contains(matrix.composer-options, '--prefer-lowest') }} run: composer test-windows + + - name: Run tests (windows-lowest) + if: ${{ matrix.os == 'windows-latest' && contains(matrix.composer-options, '--prefer-lowest') }} + run: composer test-windows-lowest diff --git a/composer.json b/composer.json index 83054a0..4068c41 100644 --- a/composer.json +++ b/composer.json @@ -60,17 +60,28 @@ "scripts": { "test-cs": "vendor/bin/phpcs -sp", "test-unit": "vendor/bin/phpunit --coverage-text", + "test-unit-lowest": "vendor/bin/phpunit --configuration=phpunit.10.0.xml --coverage-text", "clear-allure-results": "rm -rf ./build/allure-results", "test-report": [ "@clear-allure-results", "vendor/bin/paratest --processes=3 --configuration=phpunit.report.xml --testsuite=positive", "vendor/bin/paratest --processes=3 --configuration=phpunit.report.xml --testsuite=negative; exit 0" ], + "test-report-lowest": [ + "@clear-allure-results", + "vendor/bin/paratest --processes=3 --configuration=phpunit.10.0.report.xml --testsuite=positive", + "vendor/bin/paratest --processes=3 --configuration=phpunit.10.0.report.xml --testsuite=negative; exit 0" + ], "test-report-windows": [ "@clear-allure-results", "vendor/bin/paratest --processes=3 --configuration=phpunit.report.xml --testsuite=positive", "vendor/bin/paratest --processes=3 --configuration=phpunit.report.xml --testsuite=negative & exit 0" ], + "test-report-windows-lowest": [ + "@clear-allure-results", + "vendor/bin/paratest --processes=3 --configuration=phpunit.10.0.report.xml --testsuite=positive", + "vendor/bin/paratest --processes=3 --configuration=phpunit.10.0.report.xml --testsuite=negative & exit 0" + ], "test-psalm": "vendor/bin/psalm --shepherd", "test": [ "@test-cs", @@ -78,11 +89,23 @@ "@test-report", "@test-psalm" ], + "test-lowest": [ + "@test-cs", + "@test-unit-lowest", + "@test-report-lowest", + "@test-psalm" + ], "test-windows": [ "@test-cs", "@test-unit", "@test-report-windows", "@test-psalm" + ], + "test-windows-lowest": [ + "@test-cs", + "@test-unit-lowest", + "@test-report-windows-lowest", + "@test-psalm" ] } } diff --git a/phpunit.10.0.report.xml b/phpunit.10.0.report.xml new file mode 100644 index 0000000..1531268 --- /dev/null +++ b/phpunit.10.0.report.xml @@ -0,0 +1,25 @@ + + + + + test/report/Generate + test/report/Generate/NegativeTest.php + + + test/report/Generate/NegativeTest.php + + + + + + diff --git a/phpunit.10.0.xml b/phpunit.10.0.xml new file mode 100644 index 0000000..843e6c0 --- /dev/null +++ b/phpunit.10.0.xml @@ -0,0 +1,23 @@ + + + + + test/unit/ + + + + + src/ + + + diff --git a/phpunit.report.xml b/phpunit.report.xml index 60298d5..3f527f7 100644 --- a/phpunit.report.xml +++ b/phpunit.report.xml @@ -1,8 +1,14 @@ diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f7ce70a..61a0901 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,17 +1,26 @@ test/unit/ - + - src/ + src/ - + + vendor/ + + diff --git a/test/report/Generate/NegativeTest.php b/test/report/Generate/NegativeTest.php index fe68a69..c12aee9 100644 --- a/test/report/Generate/NegativeTest.php +++ b/test/report/Generate/NegativeTest.php @@ -4,13 +4,17 @@ namespace Qameta\Allure\PHPUnit\Test\Report\Generate; -use PHPUnit\Event; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; use PHPUnit\Framework\TestCase; use Qameta\Allure\Allure; use Qameta\Allure\Attribute\DisplayName; use Qameta\Allure\PHPUnit\ExceptionDetailsTrait; use RuntimeException; +use function trigger_error; + +use const E_USER_WARNING; + class NegativeTest extends TestCase { use ExceptionDetailsTrait; @@ -51,22 +55,10 @@ function () { ); } - #[DisplayName('Test that emits warning is reported as broken')] + #[DisplayName('Test that emits warning is reported as broken'), DoesNotPerformAssertions] public function testWarning(): void { - /** - * @psalm-suppress InternalMethod - * @psalm-suppress InternalClass - * @psalm-suppress TooManyArguments - */ - Event\Facade::emitter()->testTriggeredWarning( - $this->valueObjectForEvents(), - "Test triggered warning", - __FILE__, - __LINE__, - false, - ); - self::assertTrue(true); + trigger_error('"Test triggered warning"', E_USER_WARNING); } #[DisplayName('Skipped test is reported as skipped')] diff --git a/test/unit/Event/EventTestTrait.php b/test/unit/Event/EventTestTrait.php index e1bc2a0..0c1bd65 100644 --- a/test/unit/Event/EventTestTrait.php +++ b/test/unit/Event/EventTestTrait.php @@ -261,6 +261,7 @@ protected function createTestWarningTriggeredEvent( 'file', 1, false, + false, ); } }