Test doubles: Difference between revisions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
A '''[[wp:Test double]]''' is any object that stands in for a real dependency in automated testing. Usually in [[PHPUnit]], we make test doubles for other classes, but you can also double PHP native functions or <abbr title="Closures are small use-once functions which are useful as parameters for callback functions like array_walk, array_map, etc. Using closure functions in PHP can help to make code more succinct, expressive, and safer. Closures can access private data of an object.">closures</abbr>. | A '''[[wp:Test double]]''' is any object that stands in for a real dependency in automated testing. Usually in [[PHPUnit]], we make test doubles for other classes, but you can also double PHP native functions or <abbr title="Closures are small use-once functions which are useful as parameters for callback functions like array_walk, array_map, etc. Using closure functions in PHP can help to make code more succinct, expressive, and safer. Closures can access private data of an object.">closures</abbr><ref>aka anonymous functions<br>https://www.php.net/manual/en/functions.anonymous.php<br>https://www.php.net/manual/en/class.closure.php</ref>. | ||
There are 5 types of Test doubles | There are 5 types of Test doubles | ||