Skip to content

Commit

Permalink
Tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Feb 24, 2023
1 parent cda3900 commit a993520
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/test-doubles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,17 @@ his "xUnit Test Patterns" book like so:
has to provide the same API as the real one so that the SUT thinks it is
the real one!

The ``createStub($type)``, ``createMock($type)``, and
``getMockBuilder($type)`` methods provided by PHPUnit can be
used in a test to automatically generate an object that can act as a test
double for the specified original type (interface or class name). This test
double object can be used in every context where an object of the original
type is expected or required.

The ``createStub($type)`` and ``createMock($type)`` methods immediately return a test
double object for the specified type (interface or class). The creation of
this test double is performed using best practice defaults: the ``__construct()`` and
The ``createStub(string $type)`` and ``createMock(string $type)`` methods can be used
in a test to automatically generate an object that can act as a test double for the
specified original type (interface or class name). This test double object can be used
in every context where an object of the original type is expected or required.

These methods return a test double object for the specified type. The creation of this
test double is performed using best practice defaults: the ``__construct()`` and
``__clone()`` methods of the original class are not executed and the arguments passed
to a method of the test double will not be cloned.

If these defaults are not what you need then you can use the ``getMockBuilder($type)``
If these defaults are not what you need then you can use the ``getMockBuilder(string $type)``
method to customize the test double generation using a fluent interface.

By default, all methods of the original class are replaced with an implementation that
Expand Down

0 comments on commit a993520

Please sign in to comment.