Skip to content

IBX-11939, IBX-12797: Merged branch '4.6' into 5.0 - #79

Merged
barw4 merged 4 commits into
5.0from
merge/4.6-to-5.0
Oct 29, 2026
Merged

barw4 merged 4 commits into
5.0from
merge/4.6-to-5.0

Conversation

@barw4

@barw4 barw4 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Steveb-p and others added 3 commits October 19, 2026 12:46
…align (#68)

* IBX-11939: Added a test case checking that both schema install paths align

Integration suites already run once on each install path: DatabaseSchemaHook executes the
SchemaBuilderEvent schema, ibexa/core's DoctrineMigrationsSchemaHook runs the Doctrine
migrations. AbstractSchemaAlignmentTestCase compares the database the suite runs on with the
schema SchemaBuilderEvent declares, so on the migrations run it fails when a migration is
missing or incomplete, listing the SQL that would make the database match.

DBAL can't read everything back the way schema.yaml declares it, so both sides leave out index
prefix lengths outside MySQL/MariaDB (and compare them as integers there), sequences, and
autoincrement on SQLite.

* IBX-11939: Extracted the connection lookup into getDatabaseConnection()

A suite may reach its database through another connection than the kernel's default one, so the
test case gets it from an overridable method, which defaults to
IbexaTestCore::getDoctrineConnection().

* IBX-11939: Moved each normalization rule into its own method

Each thing DBAL can't read back the way schema.yaml declares it now has a private method whose
name and docblock say why it's left out of the comparison: ignoreSerialColumnSequence(),
normalizeIndexPrefixLengths() and ignoreAutoincrementOnSqlite(). replaceIndexOptions() re-adds
an index with other options, since an index's options can't be changed.

* IBX-11939: Compared strings longer than the platform's VARCHAR limit as text

DBAL creates a string column longer than the platform allows as a text one (a CLOB on SQLite,
where the limit is 4000), so it reads back as text. product-catalog's description columns
(string, length 10000) showed up as different on SQLite because of that.

* IBX-11939: Exposed SchemaBuilderInterface in IbexaTestKernel

IbexaTestKernel always registers DoctrineSchemaBundle, so the schema builder is always there.
Exposing it lets AbstractSchemaAlignmentTestCase get it through
IbexaTestCore::getServiceByClassName(), like every other service a test needs, instead of
reaching into the container itself.

* IBX-11939: Extracted the schema builder lookup into getSchemaBuilder()

Like getDatabaseConnection(), it's protected so a suite can override where the schema it compares
with comes from. It defaults to the SchemaBuilderInterface the kernel exposes.

* IBX-11939: Returned early from the normalization rules that don't apply

ignoreAutoincrementOnSqlite() and treatOverlongStringAsText() now return as soon as the column or
platform isn't one they handle, instead of wrapping their whole body in a condition.

* IBX-11939: Asserted that index prefix lengths are an array instead of casting them

By the time they're read, hasOption() has ruled out null, and wherever they come from - DBAL's
schema managers or doctrine-schema's importer - they're a list with one entry per column.

* IBX-11939: Tested the schema alignment rules on real databases

- Renamed ignoreSerialColumnSequence() to ignoreSequences(): it drops every sequence, and its
  docblock now says why they aren't matched to their SERIAL columns.
- Explained on ignoreAutoincrementOnSqlite() why leaving out composite keys alone isn't enough.
- Added an integration suite (phpunit.integration.xml, composer test-integration) whose bootstrap
  installs the kernel's SchemaBuilderEvent schema:
  - SchemaAlignmentTest, an empty subclass, runs the test case itself; it passes by construction.
  - SchemaAlignmentNormalizationTest creates each case the comparison normalizes, and checks that
    it compares as declared, and on which platforms the plain comparison differs.
- CI runs it on SQLite, PostgreSQL 14, MySQL 8.0 and MariaDB 10.11.

* IBX-11939: Asserted the statements the schema comparison reports

The prefix length and VARCHAR limit cases only checked that something was reported; they now
check that it's the index or column change.

* IBX-11939: Tested the schema alignment test case through its override points

compareSchemas() was public only for this package's own tests. They now run
testDatabaseMatchesTheSchemaBuilderEventSchema() on a stub subclass that overrides
getDatabaseConnection() and getSchemaBuilder(), so it's private again.

* IBX-11939: Declared the schema alignment cases in a schema.yaml

Each case the comparison normalizes is now declared in tests/integration/Schema/_fixtures/schema.yaml,
the way packages declare their schema:
- The integration kernel adds it with core's BuildSchemaSubscriber, so the bootstrap installs it
  through SchemaBuilderEvent, and SchemaAlignmentTest compares it on every database.
- SchemaAlignmentNormalizationTest reads those tables back, instead of creating its own, and only
  checks where the plain comparison differs.
- The unit test imports the same file with doctrine-schema's SchemaImporter, instead of building
  the declared schema by hand.

* IBX-11939: Named the index and column the schema alignment test helpers change

* IBX-11939: Lowercased the platform variable names in the schema alignment test

* IBX-11939: Applied ibexa/code-style 2.3.1 to the schema alignment test case

4.6 now requires ibexa/code-style ~2.3.1 (#70), whose PHP CS Fixer wraps signatures with several
parameters, calls createStub() statically, writes empty class bodies on one line and imports the
classes docblocks refer to.
…th in a bootstrap (#73)

* IBX-11939: Added SchemaInstallPath to select either schema install path in a bootstrap

Packages that run their integration suite on both install paths each repeated the same
DatabaseSchemaHook and DoctrineMigrationsSchemaHook options. getBootstrapperOptions() returns
them for the path the package picks, so the package still decides how, usually with an
environment variable its CI sets.

* IBX-11939: Made SchemaInstallPath take whether the Doctrine Migrations path is enabled
@barw4 barw4 added the Fast-forward merge PR should be merged in a fast-forward way label Oct 29, 2026
@barw4
barw4 marked this pull request as ready for review October 29, 2026 10:23
@barw4
barw4 requested a review from Steveb-p October 29, 2026 10:24
@barw4
barw4 merged commit 04398f7 into 5.0 Oct 29, 2026
8 checks passed
@barw4
barw4 deleted the merge/4.6-to-5.0 branch October 29, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fast-forward merge PR should be merged in a fast-forward way

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants