Lines Matching refs:method

89 The result of the `prophesize()` method call is a new object of class `ObjectProphecy`. Yes,
115 point about dummies is that they do not hold any logic - they just do nothing. Any method
118 a token object to satisfy a method typehint.
134 method signature does different things (has logic). To create stubs in Prophecy:
142 method with arguments prophecy. Method prophecies give you the ability to create method
143 promises or predictions. We'll talk about method predictions later in the _Mocks_ section.
148 and they are handled by the `MethodProphecy::will(PromiseInterface $promise)` method.
156 This promise will cause any call to our double's `read()` method with exactly one
160 - `ReturnPromise` or `->willReturn(1)` - returns a value from a method call
161 - `ReturnArgumentPromise` or `->willReturnArgument($index)` - returns the nth method argument from …
162 - `ThrowPromise` or `->willThrow($exception)` - causes the method to throw specific exception
170 Prophecy enforces same method prophecies and, as a consequence, same promises and
171 predictions for the same method calls with the same arguments. This means:
183 behaviors where some method call changes behavior of others. In PHPUnit or Mockery
184 you do that by predicting how many times your method will be called. In Prophecy,
216 You see, even if method arguments used during method prophecy creation look
217 like simple method arguments, in reality they are not. They are argument token
243 - `ObjectStateToken` or `Argument::which($method, $value)` - checks that the argument method returns
307 wildcard then uses to calculate the final arguments match score and use the method prophecy
310 `setName()` method prophecy and its promise. The simple rule of thumb - more precise token
315 Ok, now we know how to define our prophecy method promises, let's get our stub from
325 (method call), Prophecy will force you to define all the communications - it throws
334 they define *predictions* instead of *promises* on method prophecies:
342 The `shouldBeCalled()` method here assigns `CallPrediction` to our method prophecy.
346 predictions. You can assign predictions to method prophecies using the
347 `MethodProphecy::should(PredictionInterface $prediction)` method. As a matter of fact,
348 the `shouldBeCalled()` method we used earlier is just a shortcut to:
354 It checks if your method of interest (that matches both the method name and the arguments wildcard)
362 In PHPUnit, you would want to put this call into the `tearDown()` method. If no predictions
367 - `CallPrediction` or `shouldBeCalled()` - checks that the method has been called 1 or more times
368 - `NoCallsPrediction` or `shouldNotBeCalled()` - checks that the method has not been called
369 - `CallTimesPrediction` or `shouldBeCalledTimes($count)` - checks that the method has been called
371 - `CallbackPrediction` or `should($callback)` - checks the method against your own custom callback
381 manually by using the `MethodProphecy::shouldHave(PredictionInterface $prediction)` method: