diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f89cac6..9aea0c0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,13 +7,23 @@ on: jobs: unit-tests: - name: PHP ${{ matrix.php-version }} + name: Neos ${{ matrix.neos-version }}, PHP ${{ matrix.php-version }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: - # The committed lock file resolves Neos 8.4, which requires PHP >= 8.2 - php-version: ['8.2', '8.3'] + include: + # Keeps the Neos 8 jobs on the PHPUnit version Neos 8 projects use + - neos-version: '8.4' + php-version: '8.2' + dev-constraints: '--with neos/buildessentials:~8.3.0 --with phpunit/phpunit:~9.6' + - neos-version: '8.4' + php-version: '8.3' + dev-constraints: '--with neos/buildessentials:~8.3.0 --with phpunit/phpunit:~9.6' + # Neos 9.2 requires PHP 8.4 and a package providing neos/contentrepositoryregistry-storageclient + - neos-version: '9.2' + php-version: '8.4' + additional-packages: 'neos/contentgraph-doctrinedbaladapter:~9.2.0' steps: - uses: actions/checkout@v4 @@ -24,6 +34,19 @@ jobs: - run: composer validate --strict - - run: composer install --prefer-dist --no-progress --no-interaction + - run: > + composer require --no-update --no-interaction + neos/neos:~${{ matrix.neos-version }}.0 + neos/media-browser:~${{ matrix.neos-version }}.0 + neos/fusion:~${{ matrix.neos-version }}.0 + ${{ matrix.additional-packages }} + + - run: composer update --prefer-dist --no-progress --no-interaction ${{ matrix.dev-constraints }} + + - name: Edit template matches the Media Browser template + run: > + diff + <(grep -v 'partial="Asset/AiClassification"' Resources/Private/Templates/Asset/Edit.html) + Packages/Application/Neos.Media.Browser/Resources/Private/Templates/Asset/Edit.html - run: bin/phpunit diff --git a/README.md b/README.md index b180d36..09c64cf 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,10 @@ pass `false` as third argument to suppress it. ## Supporting a new Neos version `Resources/Private/Templates/Asset/Edit.html` is a copy of the Media Browser template and differs from it by a -single `f:render` line. Diff it against the upstream template of the new Neos version and re-apply that line. -That copy is what ties the package to a Neos version, not the PHP code — the `neos/*` constraints in -`composer.json` have to match the Neos version the template was copied from. +single `f:render` line. That copy is what ties the package to a Neos version, not the PHP code. The Media Browser +template is the same in Neos 8.4 and 9.2, so one copy serves both. + +The CI workflow checks this for every Neos version in its matrix: it diffs the copy, minus the `f:render` line, +against the installed upstream template. To support a new Neos version, add it to the matrix and widen the +`neos/*` constraints in `composer.json`. If the template check fails, the upstream template has changed and a +single copy can no longer serve all supported versions. diff --git a/Tests/Unit/Domain/Repository/AssetAiClassificationRepositoryTest.php b/Tests/Unit/Domain/Repository/AssetAiClassificationRepositoryTest.php index 069a4cc..2fc253f 100644 --- a/Tests/Unit/Domain/Repository/AssetAiClassificationRepositoryTest.php +++ b/Tests/Unit/Domain/Repository/AssetAiClassificationRepositoryTest.php @@ -2,10 +2,10 @@ namespace Networkteam\Neos\AssetAiClassification\Tests\Unit\Domain\Repository; +use Doctrine\ORM\Configuration; use Doctrine\ORM\EntityManager; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Tools\SchemaTool; -use Doctrine\ORM\Tools\Setup; use Doctrine\Persistence\Mapping\Driver\StaticPHPDriver; use Neos\Flow\Persistence\Aspect\PersistenceMagicInterface; use Neos\Flow\Persistence\Doctrine\PersistenceManager; @@ -28,7 +28,11 @@ class AssetAiClassificationRepositoryTest extends UnitTestCase protected function setUp(): void { parent::setUp(); - $configuration = Setup::createConfiguration(true); + // Built by hand: Doctrine's setup helpers require a cache library that Neos 9 does not install + $configuration = new Configuration(); + $configuration->setProxyDir(sys_get_temp_dir()); + $configuration->setProxyNamespace('Networkteam\Neos\AssetAiClassification\Tests\Proxies'); + $configuration->setAutoGenerateProxyClasses(true); $configuration->setMetadataDriverImpl(new StaticPHPDriver([__DIR__])); $this->entityManager = EntityManager::create(['driver' => 'pdo_sqlite', 'memory' => true], $configuration); (new SchemaTool($this->entityManager))->createSchema([ diff --git a/Tests/Unit/Migrations/AssetAiClassificationMigrationTest.php b/Tests/Unit/Migrations/AssetAiClassificationMigrationTest.php index 1c0f7eb..6ea8213 100644 --- a/Tests/Unit/Migrations/AssetAiClassificationMigrationTest.php +++ b/Tests/Unit/Migrations/AssetAiClassificationMigrationTest.php @@ -37,7 +37,7 @@ public function foreignKeyColumnUsesTheReferencedColumnsEncoding(string $charset self::assertStringContainsString('REFERENCES neos_media_domain_model_asset (persistence_object_identifier) ON DELETE CASCADE', $queries[1]->getStatement()); } - public function assetIdentifierEncodings(): array + public static function assetIdentifierEncodings(): array { return [ 'MySQL 5.7 legacy' => ['utf8', 'utf8_unicode_ci', new MySQL57Platform()], diff --git a/composer.json b/composer.json index 44063be..e131326 100644 --- a/composer.json +++ b/composer.json @@ -10,13 +10,13 @@ ], "require": { "php": "^8.0", - "neos/neos": "^8.3", - "neos/media-browser": "^8.3", - "neos/fusion": "^8.3" + "neos/neos": "^8.3 || ^9.0", + "neos/media-browser": "^8.3 || ^9.0", + "neos/fusion": "^8.3 || ^9.0" }, "require-dev": { - "phpunit/phpunit": "~9.1", - "neos/buildessentials": "~8.3.0", + "phpunit/phpunit": "~9.1 || ~11.5", + "neos/buildessentials": "~8.3.0 || ~9.0", "mikey179/vfsstream": "~1.6" }, "autoload": {