Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()],
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Loading