Skip to content

Commit

Permalink
Recommend Prophecy for test doubles creation
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Aug 23, 2016
1 parent 0a9dfec commit 6ea1599
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions project/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ Some rules have to be respected about the test:
* Most of the time, the test class should have the same name as the targeted class, suffixed by `Test`.
* The `@expectedException*` annotations are prohibited. Use `PHPUnit_Framework_TestCase::setExpectedException()`.

##### Using test doubles

Since phpunit 4.5, phpunit requires and [integrates](https://phpunit.de/manual/current/en/test-doubles.html#test-doubles.prophecy)
the [phpspec/prophecy](https://github.com/phpspec/prophecy).
Historically, Sonata has been using [the built-in test doubles implementation](https://phpunit.de/manual/current/en/test-doubles.html),
but has deciding to move to Prophecy, which is more concise than its built-in counterpart is most cases.
This means the current Sonata codebase currently uses both implementations.
If you want to contribute a test that uses test doubles, please follow these rules :

1. All new test classes MUST use Prophecy.
2. If you are changing an existing test class, you MUST use the same implementation it already uses.
3. You MAY submit a PR that migrates a test class from the built-in test double implementation to Prophecy.

### Writing a Pull Request

#### The subject
Expand Down

0 comments on commit 6ea1599

Please sign in to comment.