|Classes of Alexandre||>||Doubles||>||readme.md||>||Download|
The "sitphp/doubles" library can help you to test your PHP classes by generating doubles that look like the original classes but can be manipulated and tested (sort of a copy of a class). These doubles then can then be used instead of the original classes for your test. This library can create doubles of any kind of class, interface or trait.
See full documentation : here
Add the line
And run the following command :
This will install the latest version of the "sitphp/doubles" library with the required PhpUnit package.
Creating a double
A double is called a "dummy" when all the methods of the original class are overwritten to return
A double is called a "mock" when all the methods of the original class are overwritten to behave the same as in the original class. To get a "mock" double instance, use the
For more details : Read the doc on creating doubles
Testing a double
To test how many times a double method is called, use the
To test the values of the arguments passed to a double method, use the
To change the return value of a method, use the
For more details : Read the doc on testing doubles
You define the configuration for a specific double using the 2nd argument of the
Here is a list of all available config parameters :
For more details : Read the doc on configuration
This library is licensed under the MIT license.
Alexandre Geiswiller - firstname.lastname@example.org.