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
342 changes: 16 additions & 326 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ You are an expert Core Contributor to API Platform, a PHP framework supporting S

* 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.
* Test-First Mandate: Your primary output should be functional tests to expose bugs or verify features. Do not fix bugs unless explicitly requested.
* 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.
* Execution Restraint: NEVER run the full PHPUnit test suite. It is too slow. Only run specific, filtered tests relevant to the current task.
* Fixture Isolation: Do not modify existing fixtures (tests/Fixtures/...). Always create new Entities, DTOs, or Models to prevent regression in other tests.
* Git Policy: Do not perform git commits unless explicitly asked.

Expand All @@ -26,7 +26,7 @@ When to use:

3. Testing Quick-Reference (Default/Symfony)

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

Common Commands:

Expand All @@ -43,12 +43,9 @@ rm -rf tests/Fixtures/app/var/cache/test
# indefinitely. Remove them before running tests:
find src -name vendor -exec rm -rf {} +

# PHPUnit (Preferred)
# PHPUnit
vendor/bin/phpunit --filter testMethodName

# Behat (Legacy)
vendor/bin/behat features/main/crud.feature:120 --format=progress

#Component Testing
cd src/Metadata
composer link ../../
Expand Down
21 changes: 6 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ See also the [related documentation for Symfony](https://symfony.com/doc/current

When you send a PR, just make sure that:

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

### Tests

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

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

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

Recommendations:

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

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

#### Behat
To run functional tests for MongoDB:

> [!WARNING]
> 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)).
MONGODB_URL=mongodb://localhost:27017 APP_ENV=mongodb vendor/bin/phpunit --group mongodb

The command to launch Behat tests is:

php -d memory_limit=-1 ./vendor/bin/behat --profile=default --stop-on-failure --format=progress

If you want to launch Behat tests for MongoDB, the command is:

MONGODB_URL=mongodb://localhost:27017 APP_ENV=mongodb php -d memory_limit=-1 ./vendor/bin/behat --profile=mongodb --stop-on-failure --format=progress

To get more details about an error, replace `--format=progress` by `-vvv`. You may run a mongo instance using docker:
You may run a mongo instance using docker:

docker run -p 27017:27017 mongo:latest

Expand Down
219 changes: 0 additions & 219 deletions behat.yml.dist

This file was deleted.

6 changes: 0 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,11 @@
"willdurand/negotiation": "^3.1"
},
"require-dev": {
"behat/behat": "^3.11",
"behat/mink": "^1.9",
"doctrine/common": "^3.2.2",
"doctrine/dbal": "^4.0",
"doctrine/doctrine-bundle": "^2.11 || ^3.1",
"doctrine/orm": "^2.17 || ^3.0",
"elasticsearch/elasticsearch": "^7.17 || ^8.4 || ^9.0",
"friends-of-behat/mink-browserkit-driver": "^1.3.1",
"friends-of-behat/mink-extension": "^2.2",
"friends-of-behat/symfony-extension": "^2.1",
"friendsofphp/php-cs-fixer": "^3.93",
"guzzlehttp/guzzle": "^6.0 || ^7.0",
"illuminate/config": "^11.0 || ^12.0 || ^13.0",
Expand All @@ -160,7 +155,6 @@
"psr/log": "^1.0 || ^2.0 || ^3.0",
"ramsey/uuid": "^4.7",
"ramsey/uuid-doctrine": "^2.0",
"soyuka/contexts": "^3.3.10",
"soyuka/pmu": "^0.2.0",
"soyuka/stubs-mongodb": "^1.0",
"symfony/asset": "^6.4 || ^7.0 || ^8.0",
Expand Down
Loading
Loading