From 9611b5d68d5638cdc3aafa0566aff983f560d36b Mon Sep 17 00:00:00 2001 From: Nils Jung Date: Tue, 13 Oct 2026 17:24:13 +0200 Subject: [PATCH 1/5] test: make unit tests run with Neos 9 dependencies Notes: - verified green on Neos 8.4 with PHPUnit 9.6 and on Neos 9.2 with PHPUnit 11.5 --- .../Repository/AssetAiClassificationRepositoryTest.php | 8 ++++++-- .../Migrations/AssetAiClassificationMigrationTest.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) 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()], From 84a703ab8ae7859fddc1cea9c536cc716e6e40da Mon Sep 17 00:00:00 2001 From: Nils Jung Date: Tue, 13 Oct 2026 17:24:17 +0200 Subject: [PATCH 2/5] feat: allow installation on Neos 9 Why: - copied Media Browser edit template is unchanged in Neos 9.2 apart from the added partial, so no template variant per Neos version Notes: - smoke-tested on Neos 9.2 with MySQL 8: migration, saving in media module and standalone media browser, Eel helper, cache flush - CI still only covers Neos 8; a Neos 9 job is follow-up work --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 44063be..6ad40db 100644 --- a/composer.json +++ b/composer.json @@ -10,9 +10,9 @@ ], "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", From 890ddfce8ea3fbc905a4d01198a790a082a61a71 Mon Sep 17 00:00:00 2001 From: Nils Jung Date: Tue, 13 Oct 2026 17:31:05 +0200 Subject: [PATCH 3/5] ci: run unit tests against Neos 8.4 and 9.2 Why: - without a lock file composer resolves the newest dev tools, so Neos 8 jobs pin PHPUnit 9 to keep testing what Neos 8 projects use Notes: - both jobs reproduced locally on PHP 8.4 with the same composer commands; the other matrix PHP versions only run on GitHub Actions Issue: neos-9 --- .github/workflows/tests.yml | 28 ++++++++++++++++++++++++---- composer.json | 4 ++-- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f89cac6..5b7f4df 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,13 +7,26 @@ 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 needs a package providing neos/contentrepositoryregistry-storageclient to be installable + - neos-version: '9.2' + php-version: '8.2' + additional-packages: 'neos/contentgraph-doctrinedbaladapter:~9.2.0' + - neos-version: '9.2' + php-version: '8.4' + additional-packages: 'neos/contentgraph-doctrinedbaladapter:~9.2.0' steps: - uses: actions/checkout@v4 @@ -24,6 +37,13 @@ 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 }} - run: bin/phpunit diff --git a/composer.json b/composer.json index 6ad40db..e131326 100644 --- a/composer.json +++ b/composer.json @@ -15,8 +15,8 @@ "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": { From d63ef83a33287de4a5b7489a901983d50132d471 Mon Sep 17 00:00:00 2001 From: Nils Jung Date: Tue, 13 Oct 2026 17:31:05 +0200 Subject: [PATCH 4/5] ci: check the edit template against the Media Browser template Issue: neos-9 --- .github/workflows/tests.yml | 6 ++++++ README.md | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5b7f4df..a8cf787 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -46,4 +46,10 @@ jobs: - 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. From 7a292495188450aee68fd23a6698e2f74b248894 Mon Sep 17 00:00:00 2001 From: Nils Jung Date: Tue, 13 Oct 2026 17:35:23 +0200 Subject: [PATCH 5/5] ci: run Neos 9.2 jobs on PHP 8.4 only Issue: neos-9 --- .github/workflows/tests.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a8cf787..9aea0c0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,10 +20,7 @@ jobs: - neos-version: '8.4' php-version: '8.3' dev-constraints: '--with neos/buildessentials:~8.3.0 --with phpunit/phpunit:~9.6' - # Neos 9 needs a package providing neos/contentrepositoryregistry-storageclient to be installable - - neos-version: '9.2' - php-version: '8.2' - additional-packages: 'neos/contentgraph-doctrinedbaladapter:~9.2.0' + # 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'