Skip to content

test: migrate doctrine behat features to ApiTestCase#8205

Open
soyuka wants to merge 2 commits into
api-platform:mainfrom
soyuka:test/migrate-doctrine-behat
Open

test: migrate doctrine behat features to ApiTestCase#8205
soyuka wants to merge 2 commits into
api-platform:mainfrom
soyuka:test/migrate-doctrine-behat

Conversation

@soyuka
Copy link
Copy Markdown
Member

@soyuka soyuka commented May 28, 2026

Summary

Removes all remaining features/doctrine/*.feature behat scenarios and replaces them with PHPUnit ApiTestCase tests, mirroring the migration pattern from prior phases.

Phase 1 — trivial features (commit c69e2a4b9)

Behat feature PHPUnit test
handle_links.feature tests/Functional/Doctrine/LinkHandlerTest.php
issue5722/subresource_without_get.feature tests/Functional/SubResource/SubResourceWithoutGetTest.php
issue6175/standard_put_entity_inheritence.feature tests/Functional/Doctrine/MappedSuperclassPutTest.php
eager_loading.feature tests/Functional/Doctrine/EagerLoadingTest.php
separated_resource.feature tests/Functional/Doctrine/SeparatedResourceTest.php
multiple_filter.feature tests/Functional/Doctrine/MultipleFilterTest.php

EagerLoadingTest reads ApiPlatform\Tests\Fixtures\TestBundle\Doctrine\Orm\EntityManager::$dql to assert the produced DQL, mirroring behat's the DQL should be equal to step.

Phase 2 — filter features (commit a3dee79f7)

Behat feature PHPUnit test
boolean_filter.feature tests/Functional/Doctrine/BooleanFilterTest.php
exists_filter.feature tests/Functional/Doctrine/ExistsFilterTest.php
numeric_filter.feature tests/Functional/Doctrine/NumericFilterTest.php
range_filter.feature tests/Functional/Doctrine/RangeFilterTest.php
date_filter.feature tests/Functional/Doctrine/DateFilterTest.php
order_filter.feature tests/Functional/Doctrine/OrderFilterTest.php
search_filter.feature tests/Functional/Doctrine/SearchFilterTest.php

Scenario outlines map to PHPUnit's #[TestWith] attribute. Postgres- and SQLite-specific scenarios are gated via $this->isSqlite() / $this->isPostgres() checks.

Stats

vendor/bin/phpunit tests/Functional/Doctrine/114 tests, 376 assertions, 5 skipped (mongo-only scenarios), 0 failures.

GraphQL features (features/graphql/*.feature) are deliberately left out of this PR.

Test plan

  • CI green on default suite
  • CI green on USE_SYMFONY_LISTENERS=1
  • CI green on mongodb suite

Drop six behat scenarios in favor of PHPUnit ApiTestCase:

- handle_links.feature                          -> tests/Functional/Doctrine/LinkHandlerTest.php
- issue5722/subresource_without_get.feature     -> tests/Functional/SubResource/SubResourceWithoutGetTest.php
- issue6175/standard_put_entity_inheritence     -> tests/Functional/Doctrine/MappedSuperclassPutTest.php
- eager_loading.feature                         -> tests/Functional/Doctrine/EagerLoadingTest.php
- separated_resource.feature                    -> tests/Functional/Doctrine/SeparatedResourceTest.php
- multiple_filter.feature                       -> tests/Functional/Doctrine/MultipleFilterTest.php

EagerLoadingTest reads
ApiPlatform\Tests\Fixtures\TestBundle\Doctrine\Orm\EntityManager::\$dql
to assert the produced DQL, mirroring behat's "the DQL should be equal to" step.
@soyuka soyuka force-pushed the test/migrate-doctrine-behat branch from a3dee79 to 66541c0 Compare May 28, 2026 14:31
Drop seven behat filter scenarios in favor of PHPUnit ApiTestCase:

- boolean_filter.feature  -> tests/Functional/Doctrine/BooleanFilterTest.php
- exists_filter.feature   -> tests/Functional/Doctrine/ExistsFilterTest.php
- numeric_filter.feature  -> tests/Functional/Doctrine/NumericFilterTest.php
- range_filter.feature    -> tests/Functional/Doctrine/RangeFilterTest.php
- date_filter.feature     -> tests/Functional/Doctrine/DateFilterTest.php
- order_filter.feature    -> tests/Functional/Doctrine/OrderFilterTest.php
- search_filter.feature   -> tests/Functional/Doctrine/SearchFilterTest.php

Scenario outlines map to PHPUnit's #[TestWith] attribute. Postgres-only
scenarios are env-gated via \$this->isSqlite()/isPostgres() checks.
@soyuka soyuka force-pushed the test/migrate-doctrine-behat branch from 66541c0 to 20a937d Compare May 28, 2026 14:52
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