From 628d46f55f424c5e6e576e9fa1fe265117d06601 Mon Sep 17 00:00:00 2001 From: Nicolas PHILIPPE Date: Sun, 8 Dec 2024 17:49:25 +0100 Subject: [PATCH] tests: add paratest permutation --- .github/workflows/ci.yml | 30 +++++++++++++++++++ composer.json | 1 + phpunit-paratest.xml.dist | 30 +++++++++++++++++++ .../WithStory/WithStoryOnClassTest.php | 8 +++-- .../WithStory/WithStoryOnMethodTest.php | 8 +++-- .../WithStory/WithStoryOnParentClassTest.php | 6 ++-- ...rForServiceFactoryInKernelTestCaseTest.php | 4 +-- .../DataProvider/DataProviderInUnitTest.php | 4 +-- ...ithNonProxyFactoryInKernelTestCaseTest.php | 4 +-- ...oviderWithProxyFactoryInKernelTestCase.php | 4 +-- .../GenericDocumentProxyFactoryTest.php | 4 +-- .../GenericEntityProxyFactoryTest.php | 4 +-- tests/Integration/Maker/MakeStoryTest.php | 1 - tests/Integration/Maker/MakerTestCase.php | 1 - 14 files changed, 89 insertions(+), 20 deletions(-) create mode 100644 phpunit-paratest.xml.dist diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f994b621..6fcfefb0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,6 +92,36 @@ jobs: run: ./phpunit shell: bash + test-with-paratest: + name: Test with paratest + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.4 + coverage: none + tools: flex + + - name: Install dependencies + uses: ramsey/composer-install@v2 + with: + dependency-versions: highest + composer-options: --prefer-dist + env: + SYMFONY_REQUIRE: 7.2.* + + - name: Set up MySQL + if: contains(matrix.database, 'mysql') + run: sudo /etc/init.d/mysql start + + - name: Test + run: vendor/bin/paratest --processes 1 --configuration phpunit-paratest.xml.dist + shell: bash + code-coverage: name: Code Coverage runs-on: ubuntu-latest diff --git a/composer.json b/composer.json index aec2e99e..44525491 100644 --- a/composer.json +++ b/composer.json @@ -27,6 +27,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8", + "brianium/paratest": "^7.6", "dama/doctrine-test-bundle": "^7.0|^8.0", "doctrine/collections": "^1.7|^2.0", "doctrine/common": "^3.2", diff --git a/phpunit-paratest.xml.dist b/phpunit-paratest.xml.dist new file mode 100644 index 00000000..189f603c --- /dev/null +++ b/phpunit-paratest.xml.dist @@ -0,0 +1,30 @@ + + + + + + + + + + + + tests + + + + + src + + + + + + + diff --git a/tests/Integration/Attribute/WithStory/WithStoryOnClassTest.php b/tests/Integration/Attribute/WithStory/WithStoryOnClassTest.php index 08cccc00..44c94ab8 100644 --- a/tests/Integration/Attribute/WithStory/WithStoryOnClassTest.php +++ b/tests/Integration/Attribute/WithStory/WithStoryOnClassTest.php @@ -15,6 +15,7 @@ use PHPUnit\Framework\Attributes\RequiresPhpunit; use PHPUnit\Framework\Attributes\RequiresPhpunitExtension; +use PHPUnit\Framework\Attributes\Test; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Zenstruck\Foundry\Attribute\WithStory; use Zenstruck\Foundry\PHPUnit\FoundryExtension; @@ -27,9 +28,9 @@ /** * @author Nicolas PHILIPPE - * @requires PHPUnit 11 + * @requires PHPUnit ^11.0 */ -#[RequiresPhpunit('11')] +#[RequiresPhpunit('^11.0')] #[RequiresPhpunitExtension(FoundryExtension::class)] #[WithStory(EntityStory::class)] final class WithStoryOnClassTest extends KernelTestCase @@ -39,6 +40,7 @@ final class WithStoryOnClassTest extends KernelTestCase /** * @test */ + #[Test] public function can_use_story_in_attribute(): void { GenericEntityFactory::assert()->count(2); @@ -50,6 +52,7 @@ public function can_use_story_in_attribute(): void /** * @test */ + #[Test] #[WithStory(EntityStory::class)] public function can_use_story_in_attribute_multiple_times(): void { @@ -59,6 +62,7 @@ public function can_use_story_in_attribute_multiple_times(): void /** * @test */ + #[Test] #[WithStory(EntityPoolStory::class)] public function can_use_another_story_at_level_class(): void { diff --git a/tests/Integration/Attribute/WithStory/WithStoryOnMethodTest.php b/tests/Integration/Attribute/WithStory/WithStoryOnMethodTest.php index e98d028c..2ae15d13 100644 --- a/tests/Integration/Attribute/WithStory/WithStoryOnMethodTest.php +++ b/tests/Integration/Attribute/WithStory/WithStoryOnMethodTest.php @@ -15,6 +15,7 @@ use PHPUnit\Framework\Attributes\RequiresPhpunit; use PHPUnit\Framework\Attributes\RequiresPhpunitExtension; +use PHPUnit\Framework\Attributes\Test; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Zenstruck\Foundry\Attribute\WithStory; use Zenstruck\Foundry\PHPUnit\FoundryExtension; @@ -28,9 +29,9 @@ /** * @author Nicolas PHILIPPE - * @requires PHPUnit 11 + * @requires PHPUnit ^11.0 */ -#[RequiresPhpunit('11')] +#[RequiresPhpunit('^11.0')] #[RequiresPhpunitExtension(FoundryExtension::class)] final class WithStoryOnMethodTest extends KernelTestCase { @@ -39,6 +40,7 @@ final class WithStoryOnMethodTest extends KernelTestCase /** * @test */ + #[Test] #[WithStory(EntityStory::class)] public function can_use_story_in_attribute(): void { @@ -51,6 +53,7 @@ public function can_use_story_in_attribute(): void /** * @test */ + #[Test] #[WithStory(EntityStory::class)] #[WithStory(EntityPoolStory::class)] public function can_use_multiple_story_in_attribute(): void @@ -61,6 +64,7 @@ public function can_use_multiple_story_in_attribute(): void /** * @test */ + #[Test] #[WithStory(ServiceStory::class)] public function can_use_service_story(): void { diff --git a/tests/Integration/Attribute/WithStory/WithStoryOnParentClassTest.php b/tests/Integration/Attribute/WithStory/WithStoryOnParentClassTest.php index 01c56f3f..59a9a1ab 100644 --- a/tests/Integration/Attribute/WithStory/WithStoryOnParentClassTest.php +++ b/tests/Integration/Attribute/WithStory/WithStoryOnParentClassTest.php @@ -15,6 +15,7 @@ use PHPUnit\Framework\Attributes\RequiresPhpunit; use PHPUnit\Framework\Attributes\RequiresPhpunitExtension; +use PHPUnit\Framework\Attributes\Test; use Zenstruck\Foundry\Attribute\WithStory; use Zenstruck\Foundry\PHPUnit\FoundryExtension; use Zenstruck\Foundry\Tests\Fixture\Factories\Entity\GenericEntityFactory; @@ -22,9 +23,9 @@ /** * @author Nicolas PHILIPPE - * @requires PHPUnit 11 + * @requires PHPUnit ^11.0 */ -#[RequiresPhpunit('11')] +#[RequiresPhpunit('^11.0')] #[RequiresPhpunitExtension(FoundryExtension::class)] #[WithStory(EntityPoolStory::class)] final class WithStoryOnParentClassTest extends ParentClassWithStoryAttributeTestCase @@ -32,6 +33,7 @@ final class WithStoryOnParentClassTest extends ParentClassWithStoryAttributeTest /** * @test */ + #[Test] public function can_use_story_in_attribute_from_parent_class(): void { GenericEntityFactory::assert()->count(5); diff --git a/tests/Integration/DataProvider/DataProviderForServiceFactoryInKernelTestCaseTest.php b/tests/Integration/DataProvider/DataProviderForServiceFactoryInKernelTestCaseTest.php index 6a1df8e3..737b1437 100644 --- a/tests/Integration/DataProvider/DataProviderForServiceFactoryInKernelTestCaseTest.php +++ b/tests/Integration/DataProvider/DataProviderForServiceFactoryInKernelTestCaseTest.php @@ -28,9 +28,9 @@ /** * @author Nicolas PHILIPPE - * @requires PHPUnit 11.4 + * @requires PHPUnit ^11.4 */ -#[RequiresPhpunit('11.4')] +#[RequiresPhpunit('^11.4')] #[RequiresPhpunitExtension(FoundryExtension::class)] final class DataProviderForServiceFactoryInKernelTestCaseTest extends KernelTestCase { diff --git a/tests/Integration/DataProvider/DataProviderInUnitTest.php b/tests/Integration/DataProvider/DataProviderInUnitTest.php index 6b0089c1..9f042eee 100644 --- a/tests/Integration/DataProvider/DataProviderInUnitTest.php +++ b/tests/Integration/DataProvider/DataProviderInUnitTest.php @@ -33,9 +33,9 @@ /** * @author Nicolas PHILIPPE - * @requires PHPUnit 11.4 + * @requires PHPUnit ^11.4 */ -#[RequiresPhpunit('11.4')] +#[RequiresPhpunit('^11.4')] #[RequiresPhpunitExtension(FoundryExtension::class)] final class DataProviderInUnitTest extends TestCase { diff --git a/tests/Integration/DataProvider/DataProviderWithNonProxyFactoryInKernelTestCaseTest.php b/tests/Integration/DataProvider/DataProviderWithNonProxyFactoryInKernelTestCaseTest.php index 50d9e211..7b654481 100644 --- a/tests/Integration/DataProvider/DataProviderWithNonProxyFactoryInKernelTestCaseTest.php +++ b/tests/Integration/DataProvider/DataProviderWithNonProxyFactoryInKernelTestCaseTest.php @@ -25,9 +25,9 @@ /** * @author Nicolas PHILIPPE - * @requires PHPUnit 11.4 + * @requires PHPUnit ^11.4 */ -#[RequiresPhpunit('11.4')] +#[RequiresPhpunit('^11.4')] #[RequiresPhpunitExtension(FoundryExtension::class)] final class DataProviderWithNonProxyFactoryInKernelTestCaseTest extends KernelTestCase { diff --git a/tests/Integration/DataProvider/DataProviderWithProxyFactoryInKernelTestCase.php b/tests/Integration/DataProvider/DataProviderWithProxyFactoryInKernelTestCase.php index a502aad1..79da5452 100644 --- a/tests/Integration/DataProvider/DataProviderWithProxyFactoryInKernelTestCase.php +++ b/tests/Integration/DataProvider/DataProviderWithProxyFactoryInKernelTestCase.php @@ -29,9 +29,9 @@ /** * @author Nicolas PHILIPPE - * @requires PHPUnit 11.4 + * @requires PHPUnit ^11.4 */ -#[RequiresPhpunit('11.4')] +#[RequiresPhpunit('^11.4')] #[RequiresPhpunitExtension(FoundryExtension::class)] abstract class DataProviderWithProxyFactoryInKernelTestCase extends KernelTestCase { diff --git a/tests/Integration/DataProvider/GenericDocumentProxyFactoryTest.php b/tests/Integration/DataProvider/GenericDocumentProxyFactoryTest.php index ae69e50f..c163c1df 100644 --- a/tests/Integration/DataProvider/GenericDocumentProxyFactoryTest.php +++ b/tests/Integration/DataProvider/GenericDocumentProxyFactoryTest.php @@ -19,9 +19,9 @@ /** * @author Nicolas PHILIPPE - * @requires PHPUnit 11.4 + * @requires PHPUnit ^11.4 */ -#[RequiresPhpunit('11.4')] +#[RequiresPhpunit('^11.4')] #[RequiresPhpunitExtension(FoundryExtension::class)] final class GenericDocumentProxyFactoryTest extends DataProviderWithProxyFactoryInKernelTestCase { diff --git a/tests/Integration/DataProvider/GenericEntityProxyFactoryTest.php b/tests/Integration/DataProvider/GenericEntityProxyFactoryTest.php index 59d1488c..d34064c8 100644 --- a/tests/Integration/DataProvider/GenericEntityProxyFactoryTest.php +++ b/tests/Integration/DataProvider/GenericEntityProxyFactoryTest.php @@ -19,9 +19,9 @@ /** * @author Nicolas PHILIPPE - * @requires PHPUnit 11.4 + * @requires PHPUnit ^11.4 */ -#[RequiresPhpunit('11.4')] +#[RequiresPhpunit('^11.4')] #[RequiresPhpunitExtension(FoundryExtension::class)] final class GenericEntityProxyFactoryTest extends DataProviderWithProxyFactoryInKernelTestCase { diff --git a/tests/Integration/Maker/MakeStoryTest.php b/tests/Integration/Maker/MakeStoryTest.php index 072bc932..81f21408 100644 --- a/tests/Integration/Maker/MakeStoryTest.php +++ b/tests/Integration/Maker/MakeStoryTest.php @@ -17,7 +17,6 @@ /** * @author Kevin Bond * @group maker - * @requires PHP 8.1 */ final class MakeStoryTest extends MakerTestCase { diff --git a/tests/Integration/Maker/MakerTestCase.php b/tests/Integration/Maker/MakerTestCase.php index b2c974cf..1e830d3d 100644 --- a/tests/Integration/Maker/MakerTestCase.php +++ b/tests/Integration/Maker/MakerTestCase.php @@ -18,7 +18,6 @@ /** * @author Kevin Bond * @group maker - * @requires PHP 8.1 */ abstract class MakerTestCase extends KernelTestCase {