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
36 changes: 33 additions & 3 deletions .github/workflows/backend-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.flysystem }}${{ !matrix.schema_builder_event && ', Doctrine Migrations' || '' }})
runs-on: "ubuntu-26.04"
timeout-minutes: 15

Expand All @@ -47,9 +47,17 @@ jobs:
flysystem:
- 'league/flysystem:^2.5'
- 'league/flysystem:^3.36'
# true = legacy, event-driven SchemaBuilderEvent path; false = the coexisting
# Doctrine Migrations path, run once, on the newest PHP.
schema_builder_event:
- true
exclude:
- php: '7.4'
flysystem: 'league/flysystem:^3.36'
include:
- php: '8.4'
flysystem: 'league/flysystem:^3.36'
schema_builder_event: false

steps:
- uses: actions/checkout@v7
Expand All @@ -74,9 +82,11 @@ jobs:

- name: Run integration test suite
run: composer run-script integration
env:
IBEXA_TEST_SCHEMA_BUILDER_EVENT_ENABLED: ${{ matrix.schema_builder_event && '1' || '0' }}

integration-tests-postgres:
name: PostgreSQL integration tests
name: PostgreSQL integration tests (${{ matrix.php }}, ${{ matrix.doctrine-persistence }}, ${{ matrix.image }}${{ !matrix.schema_builder_event && ', Doctrine Migrations' || '' }})
needs: tests
services:
postgres:
Expand Down Expand Up @@ -108,6 +118,15 @@ jobs:
image:
- 'postgres:14'
- 'postgres:18'
# true = legacy, event-driven SchemaBuilderEvent path; false = the coexisting
# Doctrine Migrations path, run once, on the newest PHP and the oldest PostgreSQL.
schema_builder_event:
- true
include:
- php: '8.4'
doctrine-persistence: 'doctrine/persistence:^3.0'
image: 'postgres:14'
schema_builder_event: false

steps:
- uses: actions/checkout@v7
Expand All @@ -130,9 +149,10 @@ jobs:
DATABASE_URL: "pgsql://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/testdb?server_version=10"
# Required by old repository tests
DATABASE: "pgsql://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/testdb"
IBEXA_TEST_SCHEMA_BUILDER_EVENT_ENABLED: ${{ matrix.schema_builder_event && '1' || '0' }}

integration-tests-mysql:
name: MySQL integration tests
name: MySQL integration tests (${{ matrix.php }}, ${{ matrix.doctrine-persistence }}, ${{ matrix.image }}${{ !matrix.schema_builder_event && ', Doctrine Migrations' || '' }})
needs: tests
services:
mysql:
Expand Down Expand Up @@ -166,6 +186,15 @@ jobs:
image:
- 'mysql:8.0'
- 'mysql:8.4'
# true = legacy, event-driven SchemaBuilderEvent path; false = the coexisting
# Doctrine Migrations path, run once, on the newest PHP and the oldest MySQL.
schema_builder_event:
- true
include:
- php: '8.4'
doctrine-persistence: 'doctrine/persistence:^3.0'
image: 'mysql:8.0'
schema_builder_event: false

steps:
- uses: actions/checkout@v7
Expand All @@ -187,6 +216,7 @@ jobs:
env:
DATABASE_URL: "mysql://mysql:mysql@127.0.0.1:${{ job.services.mysql.ports[3306] }}/testdb"
DATABASE: "mysql://mysql:mysql@127.0.0.1:${{ job.services.mysql.ports[3306] }}/testdb"
IBEXA_TEST_SCHEMA_BUILDER_EVENT_ENABLED: ${{ matrix.schema_builder_event && '1' || '0' }}

solr-integration:
name: "Solr integration tests"
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"behat/behat": "^3.6.1",
"composer-runtime-api": "^2.0",
"dama/doctrine-test-bundle": "^6.7",
"doctrine/doctrine-migrations-bundle": "^3.2",
"jenner/simple_fork": "^1.2",
"friends-of-behat/mink-extension": "^2.4",
"ibexa/ci-scripts": "^0.2@dev",
Expand Down
1 change: 1 addition & 0 deletions phpunit-integration-legacy-solr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<exclude>tests/integration/Core/Repository/SearchServiceContentNameTest.php</exclude>
<exclude>tests/integration/Core/Repository/SearchServiceImageTest.php</exclude>
<exclude>tests/integration/Core/Repository/KeywordFieldCriterionTest.php</exclude>
<exclude>tests/integration/Core/SchemaAlignmentTest.php</exclude>
</testsuite>
</testsuites>
<filter>
Expand Down
1 change: 1 addition & 0 deletions phpunit-integration-legacy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<exclude>tests/integration/Core/Repository/SearchServiceImageTest.php</exclude>
<exclude>tests/integration/Core/Repository/Filtering/LegacyContentFilteringTest.php</exclude>
<exclude>tests/integration/Core/Repository/KeywordFieldCriterionTest.php</exclude>
<exclude>tests/integration/Core/SchemaAlignmentTest.php</exclude>
</testsuite>
<testsuite name="integration_debug">
<directory>tests/integration/Debug</directory>
Expand Down
1 change: 1 addition & 0 deletions phpunit-integration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<file>tests/integration/Core/Repository/SearchServiceImageTest.php</file>
<file>tests/integration/Core/Repository/Filtering/LegacyContentFilteringTest.php</file>
<file>tests/integration/Core/Repository/KeywordFieldCriterionTest.php</file>
<file>tests/integration/Core/SchemaAlignmentTest.php</file>
</testsuite>
</testsuites>
<extensions>
Expand Down
16 changes: 16 additions & 0 deletions tests/integration/Core/SchemaAlignmentTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Tests\Integration\Core;

use Ibexa\Contracts\Test\Core\Schema\AbstractSchemaAlignmentTestCase;

/**
* @coversNothing
*/
final class SchemaAlignmentTest extends AbstractSchemaAlignmentTestCase {}
7 changes: 7 additions & 0 deletions tests/integration/Core/TestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
namespace Ibexa\Tests\Integration\Core;

use DAMA\DoctrineTestBundle\DAMADoctrineTestBundle;
use Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle;
use Ibexa\Bundle\DoctrineMigrations\IbexaDoctrineMigrationsBundle;
use Ibexa\Bundle\Test\Core\IbexaTestCoreBundle;
use Ibexa\Contracts\Core\Persistence\Handler;
use Ibexa\Contracts\Core\Repository\BookmarkService;
Expand All @@ -27,6 +29,9 @@
* Registers DAMADoctrineTestBundle so mutating tests can run without reimporting schema/fixtures
* before each one: DAMA wraps each test in a transaction that's rolled back afterwards, layered on
* top of the one-time schema/fixture import tests/integration/bootstrap.php already does.
*
* Registers the two Doctrine Migrations bundles for the Doctrine Migrations install path, which
* tests/integration/bootstrap.php takes with IBEXA_TEST_SCHEMA_BUILDER_EVENT_ENABLED=0.
*/
final class TestKernel extends BaseIbexaTestKernel
{
Expand All @@ -44,6 +49,8 @@ public function registerBundles(): iterable
yield from parent::registerBundles();

yield new IbexaTestCoreBundle();
yield new DoctrineMigrationsBundle();
yield new IbexaDoctrineMigrationsBundle();
yield new DAMADoctrineTestBundle();
}

Expand Down
12 changes: 11 additions & 1 deletion tests/integration/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@
declare(strict_types=1);

use Ibexa\Contracts\Test\Core\Bootstrapper\Bootstrapper;
use Ibexa\Contracts\Test\Core\Bootstrapper\SchemaInstallPath;

require_once dirname(__DIR__, 2) . '/bootstrap.php';

(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';

// BaseFixtureHook stays on for both paths, like the test kernel's own fixtures: the tests here
// assert against test_data.yaml's content, not the clean-install content ImportDataMigration
// inserts. The fixture importer truncates the tables it fills, so the fixtures replace that
// content rather than colliding with it.
(new Bootstrapper())->bootstrap(null, SchemaInstallPath::getBootstrapperOptions($doctrineMigrationsEnabled));
Loading