diff --git a/.github/workflows/backend-ci.yaml b/.github/workflows/backend-ci.yaml index 565a1e16..bbfaad93 100644 --- a/.github/workflows/backend-ci.yaml +++ b/.github/workflows/backend-ci.yaml @@ -33,7 +33,7 @@ jobs: composer run-script check-cs -- --format=checkstyle | cs2pr tests: - name: Unit tests & SQLite integration tests + name: Unit tests & SQLite integration tests (${{ matrix.php }}${{ !matrix.schema_builder_event && ', Doctrine Migrations' || '' }}) runs-on: "ubuntu-26.04" timeout-minutes: 15 @@ -42,6 +42,12 @@ jobs: matrix: php: - '8.5' + schema_builder_event: + - true + # One more run, on the Doctrine Migrations install path. + include: + - php: '8.5' + schema_builder_event: false steps: - uses: actions/checkout@v7 @@ -62,3 +68,5 @@ jobs: - name: Run test suite run: composer run-script --timeout=600 test + env: + IBEXA_TEST_SCHEMA_BUILDER_EVENT_ENABLED: ${{ matrix.schema_builder_event && '1' || '0' }} diff --git a/composer.json b/composer.json index e671440b..80bf0cea 100644 --- a/composer.json +++ b/composer.json @@ -43,6 +43,7 @@ "twig/twig": "^3.0" }, "require-dev": { + "doctrine/doctrine-migrations-bundle": "^3.2", "ibexa/code-style": "~2.3.1", "ibexa/design-engine": "~6.0.x-dev", "ibexa/doctrine-schema": "~6.0.x-dev", diff --git a/tests/bootstrap.php b/tests/bootstrap.php index fdfee57d..a77c8ece 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -6,10 +6,21 @@ */ declare(strict_types=1); +use Ibexa\Contracts\Test\Core\Bootstrapper\BaseFixtureHook; use Ibexa\Contracts\Test\Core\Bootstrapper\Bootstrapper; +use Ibexa\Contracts\Test\Core\Bootstrapper\SchemaInstallPath; require dirname(__DIR__) . '/vendor/autoload.php'; chdir(__DIR__ . '/..'); -(new Bootstrapper())->bootstrap(); +// Selects which of the two coexisting schema install paths this run exercises: the +// SchemaBuilderEvent one by default, or the Doctrine Migrations one with +// IBEXA_TEST_SCHEMA_BUILDER_EVENT_ENABLED=0. +$doctrineMigrationsEnabled = getenv('IBEXA_TEST_SCHEMA_BUILDER_EVENT_ENABLED') === '0'; + +(new Bootstrapper())->bootstrap(null, SchemaInstallPath::getBootstrapperOptions($doctrineMigrationsEnabled) + [ + // On the Doctrine Migrations path, ibexa/core's ImportDataMigration has already inserted the + // baseline repository content. + BaseFixtureHook::class => [BaseFixtureHook::OPTION_LOAD_BASE_FIXTURE => !$doctrineMigrationsEnabled], +]); diff --git a/tests/bundle/Command/UpdateUserCommandTest.php b/tests/bundle/Command/UpdateUserCommandTest.php index 134c7c79..3ecd47d4 100644 --- a/tests/bundle/Command/UpdateUserCommandTest.php +++ b/tests/bundle/Command/UpdateUserCommandTest.php @@ -68,10 +68,12 @@ public function testExecuteWithEnableAndDisableOptionsReturnsFailure(): void public function testExecuteReturnsSuccess(): void { + // `--password` without a value, so the command asks for it + $this->commandTester->setInputs(['Ibexa-Password1']); $this->commandTester->execute( [ 'user' => 'anonymous', - '--password' => true, + '--password' => null, '--email' => 'foo@bar.com', '--enable' => true, ], diff --git a/tests/integration/IbexaTestKernel.php b/tests/integration/IbexaTestKernel.php index c816d7cd..a278a532 100644 --- a/tests/integration/IbexaTestKernel.php +++ b/tests/integration/IbexaTestKernel.php @@ -8,7 +8,9 @@ namespace Ibexa\Tests\Integration\User; +use Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle; use Ibexa\Bundle\ContentForms\IbexaContentFormsBundle; +use Ibexa\Bundle\DoctrineMigrations\IbexaDoctrineMigrationsBundle; use Ibexa\Bundle\Notifications\IbexaNotificationsBundle; use Ibexa\Bundle\Test\Core\IbexaTestCoreBundle; use Ibexa\Bundle\User\IbexaUserBundle; @@ -30,6 +32,10 @@ public function registerBundles(): iterable yield new IbexaTestCoreBundle(); + yield new DoctrineMigrationsBundle(); + + yield new IbexaDoctrineMigrationsBundle(); + yield from [ new IbexaUserBundle(), new IbexaNotificationsBundle(), diff --git a/tests/integration/SchemaAlignmentTest.php b/tests/integration/SchemaAlignmentTest.php new file mode 100644 index 00000000..b00f7fa2 --- /dev/null +++ b/tests/integration/SchemaAlignmentTest.php @@ -0,0 +1,15 @@ +