Chris@14
|
1 <?php
|
Chris@14
|
2 /*
|
Chris@14
|
3 * This file is part of the phpunit-mock-objects package.
|
Chris@14
|
4 *
|
Chris@14
|
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
|
Chris@14
|
6 *
|
Chris@14
|
7 * For the full copyright and license information, please view the LICENSE
|
Chris@14
|
8 * file that was distributed with this source code.
|
Chris@14
|
9 */
|
Chris@14
|
10 namespace PHPUnit\Framework\MockObject\Matcher;
|
Chris@14
|
11
|
Chris@14
|
12 use PHPUnit\Framework\MockObject\Invocation as BaseInvocation;
|
Chris@14
|
13
|
Chris@14
|
14 /**
|
Chris@14
|
15 * Invocation matcher which does not care about previous state from earlier
|
Chris@14
|
16 * invocations.
|
Chris@14
|
17 *
|
Chris@14
|
18 * This abstract class can be implemented by matchers which does not care about
|
Chris@14
|
19 * state but only the current run-time value of the invocation itself.
|
Chris@14
|
20 */
|
Chris@14
|
21 abstract class StatelessInvocation implements Invocation
|
Chris@14
|
22 {
|
Chris@14
|
23 /**
|
Chris@14
|
24 * Registers the invocation $invocation in the object as being invoked.
|
Chris@14
|
25 * This will only occur after matches() returns true which means the
|
Chris@14
|
26 * current invocation is the correct one.
|
Chris@14
|
27 *
|
Chris@14
|
28 * The matcher can store information from the invocation which can later
|
Chris@14
|
29 * be checked in verify(), or it can check the values directly and throw
|
Chris@14
|
30 * and exception if an expectation is not met.
|
Chris@14
|
31 *
|
Chris@14
|
32 * If the matcher is a stub it will also have a return value.
|
Chris@14
|
33 *
|
Chris@14
|
34 * @param BaseInvocation $invocation Object containing information on a mocked or stubbed method which was invoked
|
Chris@14
|
35 *
|
Chris@14
|
36 * @return mixed
|
Chris@14
|
37 */
|
Chris@14
|
38 public function invoked(BaseInvocation $invocation)
|
Chris@14
|
39 {
|
Chris@14
|
40 }
|
Chris@14
|
41
|
Chris@14
|
42 /**
|
Chris@14
|
43 * Checks if the invocation $invocation matches the current rules. If it does
|
Chris@14
|
44 * the matcher will get the invoked() method called which should check if an
|
Chris@14
|
45 * expectation is met.
|
Chris@14
|
46 *
|
Chris@14
|
47 * @param Invocation $invocation Object containing information on a mocked or stubbed method which was invoked
|
Chris@14
|
48 *
|
Chris@14
|
49 * @return bool
|
Chris@14
|
50 */
|
Chris@14
|
51 public function verify()
|
Chris@14
|
52 {
|
Chris@14
|
53 }
|
Chris@14
|
54 }
|