Skip to content

Skip base test_data.yaml fixture when Doctrine Migrations already imported it - #42

Closed
Steveb-p wants to merge 1 commit into
4.6from
skip-base-fixture-when-migrations-imported
Closed

Skip base test_data.yaml fixture when Doctrine Migrations already imported it#42
Steveb-p wants to merge 1 commit into
4.6from
skip-base-fixture-when-migrations-imported

Conversation

@Steveb-p

@Steveb-p Steveb-p commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator
🎫 Issue IBX-XXXXX

Description:

IbexaTestKernel::getFixtures() unconditionally imports test_data.yaml as baseline test content. When a test kernel runs the Doctrine Migrations schema-install path instead of the legacy SchemaBuilderEvent one (ibexa:doctrine:migrations:migrate instead of dispatching the event), Ibexa\Bundle\RepositoryInstaller\Migration\ImportDataMigration already inserts that same baseline content as part of schema install. Importing test_data.yaml on top of that throws UniqueConstraintViolationException.

Skips the base fixture when IBEXA_TEST_SCHEMA_BUILDER_EVENT_ENABLED=0. Package-specific fixtures added by subclasses (yield from parent::getFixtures(); yield new Fixture(...)) are unaffected either way — they're additive, not overlapping with ImportDataMigration's output.

…orted it

Ibexa\Bundle\RepositoryInstaller\Migration\ImportDataMigration (run via
ibexa:doctrine:migrations:migrate when the SchemaBuilderEvent path is
disabled) inserts the same baseline content that IbexaTestKernel's
default getFixtures() also unconditionally imports via test_data.yaml,
causing a UniqueConstraintViolationException on the second import.

Package-specific fixtures added by subclasses (`yield from
parent::getFixtures(); yield new Fixture(...)`) are unaffected and still
run in both modes, since they're additive rather than overlapping with
ImportDataMigration's output.
@Steveb-p
Steveb-p force-pushed the skip-base-fixture-when-migrations-imported branch 2 times, most recently from 40c4aac to 9165614 Compare September 9, 2026 08:05
@Steveb-p

Steveb-p commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

Closing — the premise no longer holds after #43.

The guard was written when ibexa/activity-log and ibexa/taxonomy hand-rolled a dual-path bootstrap that genuinely ran ibexa:doctrine:migrations:migrate, so ImportDataMigration inserted the same baseline test_data.yaml provides. #43 removed that path from test-core, and no 4.6 package runs migrations in tests any more.

Two concrete problems with it as it stands:

  • Unreachable for packages with their own FixtureProvider. FixtureProviderChain takes the first non-null provider by priority, and a package provider sits at 200 versus FixtureKernelMethodProvider's 0 — those providers inject DefaultFixtureProvider directly, so the kernel method is never consulted. Checked against activity-log: env=0 and env=1 both give 124/855/1, identical.
  • Harmful for packages without one. measurement, where the kernel method is the fallback, dies in bootstrap with Could not find 'user' with identifier 'admin' (vs 221/775/2 unguarded) — nothing supplies the baseline once test_data.yaml is skipped.

Skipping fixture import is already supported via FixtureHook::OPTION_LOAD_FIXTURES => false from the consumer's own bootstrap, which doesn't require test-core to know about a downstream CI env var.

Exercising the Doctrine Migrations install path in tests will be revisited separately, via two distinct bootstrap setups rather than a flag threaded through the shared kernel.

@Steveb-p Steveb-p closed this Sep 9, 2026
@Steveb-p
Steveb-p deleted the skip-base-fixture-when-migrations-imported branch September 9, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant