From a9935201774b3731854108ed7f0506fdfde8c38d Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Fri, 24 Feb 2023 08:39:28 +0100 Subject: [PATCH] Tweak --- src/test-doubles.rst | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/test-doubles.rst b/src/test-doubles.rst index 12725981..d0938eda 100644 --- a/src/test-doubles.rst +++ b/src/test-doubles.rst @@ -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