Skip to content

Commit 4911cfd

Browse files
authored
test: migrate doctrine/graphql behat features to ApiTestCase (#8205)
1 parent 374c61d commit 4911cfd

93 files changed

Lines changed: 8417 additions & 14050 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 16 additions & 326 deletions
Large diffs are not rendered by default.

AGENTS.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ You are an expert Core Contributor to API Platform, a PHP framework supporting S
66

77
* Context Retrieval (VectorCode): Before writing new code or asking for clarification, ALWAYS use vectorcode if available to search for existing patterns, interfaces, or similar implementations in the codebase.
88
* Test-First Mandate: Your primary output should be functional tests to expose bugs or verify features. Do not fix bugs unless explicitly requested.
9-
* Execution Restraint: NEVER run the full test suite (Behat or PHPUnit). It is too slow. Only run specific, filtered tests relevant to the current task.
9+
* Execution Restraint: NEVER run the full PHPUnit test suite. It is too slow. Only run specific, filtered tests relevant to the current task.
1010
* Fixture Isolation: Do not modify existing fixtures (tests/Fixtures/...). Always create new Entities, DTOs, or Models to prevent regression in other tests.
1111
* Git Policy: Do not perform git commits unless explicitly asked.
1212

@@ -26,7 +26,7 @@ When to use:
2626

2727
3. Testing Quick-Reference (Default/Symfony)
2828

29-
For advanced configurations (Event Listeners, MongoDB, Behat tuning), refer to `tests/AGENTS.md`.
29+
For advanced configurations (Event Listeners, MongoDB), refer to `tests/AGENTS.md`.
3030

3131
Common Commands:
3232

@@ -43,12 +43,9 @@ rm -rf tests/Fixtures/app/var/cache/test
4343
# indefinitely. Remove them before running tests:
4444
find src -name vendor -exec rm -rf {} +
4545
46-
# PHPUnit (Preferred)
46+
# PHPUnit
4747
vendor/bin/phpunit --filter testMethodName
4848
49-
# Behat (Legacy)
50-
vendor/bin/behat features/main/crud.feature:120 --format=progress
51-
5249
#Component Testing
5350
cd src/Metadata
5451
composer link ../../

CONTRIBUTING.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ See also the [related documentation for Symfony](https://symfony.com/doc/current
8787

8888
When you send a PR, just make sure that:
8989

90-
* You add valid test cases (Behat and PHPUnit).
90+
* You add valid test cases (PHPUnit).
9191
* Tests are green.
9292
* You make a PR on the related documentation in the [api-platform/docs](https://github.com/api-platform/docs) repository.
9393
* You make the PR on the same branch you based your changes on. If you see commits
@@ -123,11 +123,11 @@ Only the first commit on a Pull Request need to use a conventional commit, other
123123

124124
### Tests
125125

126-
On `api-platform/core` there are two kinds of tests: unit (`phpunit`) and integration tests (`behat`).
126+
On `api-platform/core` tests are written with `phpunit` (unit tests and functional tests under `tests/Functional`).
127127

128128
Note that we stopped using `prophesize` for new tests since 3.2, use `phpunit` stub system.
129129

130-
Both `phpunit` and `behat` are development dependencies and should be available in the `vendor` directory.
130+
`phpunit` is a development dependency and should be available in the `vendor` directory.
131131

132132
Recommendations:
133133

@@ -157,20 +157,11 @@ Sometimes there might be an error with too many open files when generating cover
157157

158158
Coverage will be available in `coverage/index.html`.
159159

160-
#### Behat
160+
To run functional tests for MongoDB:
161161

162-
> [!WARNING]
163-
> Please **do not add new Behat tests**, use a functional test (for example: [ComputedFieldTest](https://github.com/api-platform/core/blob/04d5cff1b28b494ac2e90257a79ce6c045ba82ae/tests/Functional/Doctrine/ComputedFieldTest.php)).
162+
MONGODB_URL=mongodb://localhost:27017 APP_ENV=mongodb vendor/bin/phpunit --group mongodb
164163

165-
The command to launch Behat tests is:
166-
167-
php -d memory_limit=-1 ./vendor/bin/behat --profile=default --stop-on-failure --format=progress
168-
169-
If you want to launch Behat tests for MongoDB, the command is:
170-
171-
MONGODB_URL=mongodb://localhost:27017 APP_ENV=mongodb php -d memory_limit=-1 ./vendor/bin/behat --profile=mongodb --stop-on-failure --format=progress
172-
173-
To get more details about an error, replace `--format=progress` by `-vvv`. You may run a mongo instance using docker:
164+
You may run a mongo instance using docker:
174165

175166
docker run -p 27017:27017 mongo:latest
176167

behat.yml.dist

Lines changed: 0 additions & 219 deletions
This file was deleted.

composer.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,11 @@
125125
"willdurand/negotiation": "^3.1"
126126
},
127127
"require-dev": {
128-
"behat/behat": "^3.11",
129-
"behat/mink": "^1.9",
130128
"doctrine/common": "^3.2.2",
131129
"doctrine/dbal": "^4.0",
132130
"doctrine/doctrine-bundle": "^2.11 || ^3.1",
133131
"doctrine/orm": "^2.17 || ^3.0",
134132
"elasticsearch/elasticsearch": "^7.17 || ^8.4 || ^9.0",
135-
"friends-of-behat/mink-browserkit-driver": "^1.3.1",
136-
"friends-of-behat/mink-extension": "^2.2",
137-
"friends-of-behat/symfony-extension": "^2.1",
138133
"friendsofphp/php-cs-fixer": "^3.93",
139134
"guzzlehttp/guzzle": "^6.0 || ^7.0",
140135
"illuminate/config": "^11.0 || ^12.0 || ^13.0",
@@ -160,7 +155,6 @@
160155
"psr/log": "^1.0 || ^2.0 || ^3.0",
161156
"ramsey/uuid": "^4.7",
162157
"ramsey/uuid-doctrine": "^2.0",
163-
"soyuka/contexts": "^3.3.10",
164158
"soyuka/pmu": "^0.2.0",
165159
"soyuka/stubs-mongodb": "^1.0",
166160
"symfony/asset": "^6.4 || ^7.0 || ^8.0",

0 commit comments

Comments
 (0)