Skip to content

Commit b2c1666

Browse files
authored
docs(contributing): behat test guide (api-platform#4520)
1 parent e50a7b5 commit b2c1666

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

CONTRIBUTING.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,23 @@ To get more details about an error, replace `--format=progress` by `-vvv`. You m
139139

140140
docker run -p 27017:27017 mongo:latest
141141

142+
Start by adding a fixture, usually using Doctrine entities in `tests/Fixtures/TestBundle/Entity`. Note that we often duplicate the fixture
143+
in the `tests/Fixtures/TestBundle/Document` directory for MongoDB ODM, if your test doesn't need to be tested with MongoDB use the `@!mongodb` group on the Behat scenario.
144+
If you need a `Given` step, add it to the doctrine context in `tests/Core/Behat/DoctrineContext.php`, for example:
145+
146+
```
147+
/**
148+
* @Given there is a payment
149+
*/
150+
public function thereIsAPayment()
151+
{
152+
$this->manager->persist(new Payment('123.45'));
153+
$this->manager->flush();
154+
}
155+
```
156+
157+
The last step is to add you feature inside `features/`. You can add your test in one of our existing features, or create your own.
158+
142159
# License and Copyright Attribution
143160

144161
When you open a Pull Request to the API Platform project, you agree to license your code under the [MIT license](LICENSE)

0 commit comments

Comments
 (0)