diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 92320f28..d9d9884a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,34 +41,34 @@ jobs: run: "composer static" tests: - name: "Test: ${{ matrix.os }} / ${{ matrix.php }} / ${{ matrix.dependencies }}" + name: "Tests: ${{ matrix.os }} / ${{ matrix.php }} / ${{ matrix.dependencies }}${{ matrix.os == 'ubuntu' && matrix.dependencies == 'high' && matrix.php == '8.3' && ' w/ coverage' || '' }}" runs-on: "${{ matrix.os }}-latest" strategy: fail-fast: false matrix: os: [ ubuntu, macos, windows ] - php: [ "8.1", "8.2" ] - dependencies: [ lowest, highest ] + php: [ "8.1", "8.2", "8.3" ] + dependencies: [ low, high ] steps: - name: "Install rsync" uses: GuillaumeFalourd/setup-rsync@v1.2 # https://github.com/marketplace/actions/setup-rsync - name: "Set up PHP w/ Coverage" - if: ${{ matrix.os == 'ubuntu' && matrix.dependencies == 'highest' }} + if: ${{ matrix.os == 'ubuntu' && matrix.dependencies == 'high' && matrix.php == '8.3' }} uses: shivammathur/setup-php@v2 # https://github.com/marketplace/actions/setup-php-action with: php-version: "${{ matrix.php }}" extensions: gd - ini-values: assert.active=1, assert.exception=1, zend.assertions=1 + ini-values: zend.assertions=1 - name: "Set up PHP w/o Coverage" - if: ${{ !( matrix.os == 'ubuntu' && matrix.dependencies == 'highest' ) }} + if: ${{ !( matrix.os == 'ubuntu' && matrix.dependencies == 'high' && matrix.php == '8.3' ) }} uses: shivammathur/setup-php@v2 # https://github.com/marketplace/actions/setup-php-action with: php-version: "${{ matrix.php }}" coverage: none extensions: gd - ini-values: assert.active=1, assert.exception=1, zend.assertions=1 + ini-values: zend.assertions=1 - name: "Debugging info" run: | @@ -81,19 +81,19 @@ jobs: - name: "Install dependencies" uses: ramsey/composer-install@v3 # https://github.com/marketplace/actions/install-composer-dependencies with: - dependency-versions: "${{ matrix.dependencies }}" + dependency-versions: "${{ matrix.dependencies }}est" - name: "Run core tests with coverage" run: "composer test" - if: ${{ matrix.os == 'ubuntu' && matrix.dependencies == 'highest' }} + if: ${{ matrix.os == 'ubuntu' && matrix.dependencies == 'high' && matrix.php == '8.3' }} # There's no reason to generate coverage data on multiple jobs--the result should be the same. - name: "Run core tests without coverage" - run: "./vendor/bin/phpunit --no-coverage --exclude-group=windows_only" - if: ${{ runner.os != 'Windows' && !( matrix.os == 'ubuntu' && matrix.dependencies == 'highest' ) }} + run: "./vendor/bin/phpunit --no-coverage --testsuite=all --exclude-group=windows_only" + if: ${{ runner.os != 'Windows' && !( matrix.os == 'ubuntu' && matrix.dependencies == 'high' && matrix.php == '8.3' ) }} - name: "Run Windows tests" - run: "./vendor/bin/phpunit --no-coverage --exclude-group=no_windows" + run: "./vendor/bin/phpunit --no-coverage --testsuite=all --exclude-group=no_windows" if: ${{ runner.os == 'Windows' }} performance: @@ -122,6 +122,28 @@ jobs: - name: "Run performance tests" run: "composer phpbench -- --progress=plain --ansi" + compatability: + name: "Compatability" + runs-on: ubuntu-latest + steps: + - name: "Install rsync" + uses: GuillaumeFalourd/setup-rsync@v1.2 # https://github.com/marketplace/actions/setup-rsync + + - name: "Set up PHP" + uses: shivammathur/setup-php@v2 # https://github.com/marketplace/actions/setup-php-action + with: + php-version: "8.3" + coverage: none + + - name: "Checkout code" + uses: actions/checkout@v4 # https://github.com/marketplace/actions/checkout + + - name: "Install dependencies" + uses: ramsey/composer-install@v3 # https://github.com/marketplace/actions/install-composer-dependencies + + - name: "Run compatability tests" + run: "composer compatability" + mutation: name: "Mutation" runs-on: ubuntu-latest @@ -131,7 +153,7 @@ jobs: with: php-version: "8.2" extensions: gd - ini-values: assert.active=1, assert.exception=1, zend.assertions=1 + ini-values: zend.assertions=1 - name: "Checkout code" uses: actions/checkout@v4 # https://github.com/marketplace/actions/checkout diff --git a/composer.json b/composer.json index d533f64e..b66c2d0d 100644 --- a/composer.json +++ b/composer.json @@ -91,7 +91,7 @@ "rm -r var/*/* &> /dev/null || true", "git checkout -- var" ], - "compatability": "phpunit -- tests/Compatability", + "compatability": "phpunit --testsuite=compatability", "dox": "phpunit --testdox --color=always --exclude-group=windows_only", "fast": "phpunit --exclude-group=slow,windows_only", "functional": "phpunit --testsuite=functional --exclude-group=windows_only", diff --git a/grumphp.yml.dist b/grumphp.yml.dist index 4553768c..007c0c33 100644 --- a/grumphp.yml.dist +++ b/grumphp.yml.dist @@ -25,6 +25,7 @@ grumphp: phpstan: use_grumphp_paths: false phpunit: + testsuite: all exclude_group: - windows_only rector: ~ diff --git a/infection.json5.dist b/infection.json5.dist index 5931aa04..2a36a7b9 100644 --- a/infection.json5.dist +++ b/infection.json5.dist @@ -18,5 +18,5 @@ "IncrementInteger": false, "RoundingFamily": false }, - "testFrameworkOptions": "--exclude-group=slow,windows_only" + "testFrameworkOptions": "--testsuite=all --exclude-group=slow,windows_only" } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 159507a3..085183fb 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -16,7 +16,8 @@ > - tests + tests + tests tests @@ -45,8 +46,6 @@ - - diff --git a/tests/Compatability/CompatabilityFunctionalTest.php b/tests/Compatability/CompatabilityTest.php similarity index 94% rename from tests/Compatability/CompatabilityFunctionalTest.php rename to tests/Compatability/CompatabilityTest.php index 15849e4a..c30e299e 100644 --- a/tests/Compatability/CompatabilityFunctionalTest.php +++ b/tests/Compatability/CompatabilityTest.php @@ -6,12 +6,8 @@ use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Process\Process; -/** - * @coversNothing - * - * @group slow - */ -final class CompatabilityFunctionalTest extends TestCase +/** @coversNothing */ +final class CompatabilityTest extends TestCase { // @see https://github.com/php-tuf/composer-stager/wiki/Library-compatibility-policy#drupal private const SUPPORTED_DRUPAL_VERSIONS = [ @@ -22,8 +18,7 @@ final class CompatabilityFunctionalTest extends TestCase '10.1.0', '10.1.2', // Next minor dev. - // @todo Drupal 11.x now require PHP 8.3. Update the test setup for support. - //'11.x-dev', + '11.x-dev', ]; public static function setUpBeforeClass(): void diff --git a/tests/Translation/Service/SymfonyTranslatorProxyTest.php b/tests/Translation/Service/SymfonyTranslatorProxyUnitTest.php similarity index 98% rename from tests/Translation/Service/SymfonyTranslatorProxyTest.php rename to tests/Translation/Service/SymfonyTranslatorProxyUnitTest.php index fa695884..cd4ac23b 100644 --- a/tests/Translation/Service/SymfonyTranslatorProxyTest.php +++ b/tests/Translation/Service/SymfonyTranslatorProxyUnitTest.php @@ -7,7 +7,7 @@ use PhpTuf\ComposerStager\Tests\TestUtils\TranslationTestHelper; /** @coversDefaultClass \PhpTuf\ComposerStager\Internal\Translation\Service\SymfonyTranslatorProxy */ -final class SymfonyTranslatorProxyTest extends TestCase +final class SymfonyTranslatorProxyUnitTest extends TestCase { /** * @covers ::getLocale diff --git a/tests/Translation/Service/TranslatorUnitTest.php b/tests/Translation/Service/TranslatorUnitTest.php index 15dc66b2..cd08b28d 100644 --- a/tests/Translation/Service/TranslatorUnitTest.php +++ b/tests/Translation/Service/TranslatorUnitTest.php @@ -233,11 +233,11 @@ public function testTranslatorException(Throwable $exception): void $expectedMessage = sprintf('Translation error: %s', $exception->getMessage()); // Disable assertions so production error-handling can be tested. - assert_options(ASSERT_ACTIVE, 0); + ini_set('zend.assertions', 0); self::assertSame($expectedMessage, $sut->trans($message), 'Returned exception message on failure.'); // Re-enable assertions so development error-handling can be tested. - assert_options(ASSERT_ACTIVE, 1); + ini_set('zend.assertions', 1); self::assertTranslatableException(static function () use ($sut, $message): void { $sut->trans($message); }, AssertionError::class, $expectedMessage); diff --git a/tests/Translation/Value/TranslationParametersUnitTest.php b/tests/Translation/Value/TranslationParametersUnitTest.php index 2989e77e..11142cfa 100644 --- a/tests/Translation/Value/TranslationParametersUnitTest.php +++ b/tests/Translation/Value/TranslationParametersUnitTest.php @@ -76,13 +76,13 @@ public function testDefaultParameters(): void public function testInvalidPlaceholders(array $given, array $expected, mixed $invalidPlaceholder): void { // Disable assertions so production error-handling can be tested. - assert_options(ASSERT_ACTIVE, 0); + ini_set('zend.assertions', 0); $sut = new TranslationParameters($given); self::assertSame($expected, $sut->getAll(), 'Returned sanitized array on failure.'); // Re-enable assertions so development error-handling can be tested. - assert_options(ASSERT_ACTIVE, 1); + ini_set('zend.assertions', 1); self::assertTranslatableException(static function () use ($given): void { new TranslationParameters($given); @@ -167,13 +167,13 @@ public function providerInvalidPlaceholders(): array public function testInvalidValues(array $given, array $expected, string $invalidType): void { // Disable assertions so production error-handling can be tested. - assert_options(ASSERT_ACTIVE, 0); + ini_set('zend.assertions', 0); $sut = new TranslationParameters($given); self::assertSame($expected, $sut->getAll(), 'Returned sanitized array on failure.'); // Re-enable assertions so development error-handling can be tested. - assert_options(ASSERT_ACTIVE, 1); + ini_set('zend.assertions', 1); self::assertTranslatableException(static function () use ($given): void { new TranslationParameters($given);