Recommend this page to a friend! |
Classes of Alexandre | Doubles | readme.md | Download |
|
DownloadSitPHP/DoublesThe "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 InstallationAdd 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 doubleA 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 doubleTo 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 ConfigurationYou 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 AboutLicenseThis library is licensed under the MIT license. AuthorAlexandre Geiswiller - alexandre.geiswiller@gmail.com. |