Test doubles: Difference between revisions

No edit summary
Line 18: Line 18:


== Dummy ==
== Dummy ==
In the example code below, we have a '''User''' class that we want to write a test for. The User object needs a Logger object passed as a parameter to its constructor. So, in the '''UserTest''' class, we create a dummy to pass to the system under test. The test double "Logger" doesn't have to do anything at all - it just exists to be passed as an argument during the test.
<syntaxhighlight lang="php">
<syntaxhighlight lang="php">