Skip to content

Commit e36ca41

Browse files
authored
Merge pull request #1011 from soyuka/behat-cache
Document api-platform/core testability
2 parents 703831e + 1891865 commit e36ca41

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

CONTRIBUTING.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,48 @@ that you did not make in your PR, you're doing it wrong.
5757

5858
All Pull Requests must include [this header](.github/PULL_REQUEST_TEMPLATE.md).
5959

60+
### Tests
61+
62+
On `api-platform/core` there are two kinds of tests: unit (`phpunit`) and integration tests (`behat`).
63+
64+
Both `phpunit` and `behat` are development dependencies and should be available in the `vendor` directory.
65+
66+
#### Phpunit and coverage generation
67+
68+
To launch unit tests:
69+
70+
```
71+
vendor/bin/phpunit --stop-on-failure -vvv
72+
```
73+
74+
If you want coverage, you will need the `phpdbg` package and run:
75+
76+
```
77+
phpdbg -qrr vendor/bin/phpunit --coverage-html coverage -vvv --stop-on-failure
78+
```
79+
80+
Sometimes there might be an error with too many open files when generating coverage. To fix this, you can increase the `ulimit`, for example:
81+
82+
```
83+
ulimit -n 4000
84+
```
85+
86+
Coverage will be available in `coverage/index.html`.
87+
88+
#### Behat
89+
90+
The command to launch Behat tests is:
91+
92+
```
93+
./vendor/bin/behat --stop-on-failure -vvv
94+
```
95+
96+
You may need to clear the cache manually before running behat tests because of the temporary sql database. To do so, just remove the `test` cache directory:
97+
98+
```
99+
rm -r tests/Fixtures/app/cache/test
100+
```
101+
60102
## Squash your commits
61103

62104
If you have 3 commits. So start with:

0 commit comments

Comments
 (0)