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 use PHPUnit\Framework\MockObject\Verifiable;
|
Chris@14
|
14 use PHPUnit\Framework\SelfDescribing;
|
Chris@14
|
15
|
Chris@14
|
16 /**
|
Chris@14
|
17 * Interface for classes which matches an invocation based on its
|
Chris@14
|
18 * method name, argument, order or call count.
|
Chris@14
|
19 */
|
Chris@14
|
20 interface Invocation extends SelfDescribing, Verifiable
|
Chris@14
|
21 {
|
Chris@14
|
22 /**
|
Chris@14
|
23 * Registers the invocation $invocation in the object as being invoked.
|
Chris@14
|
24 * This will only occur after matches() returns true which means the
|
Chris@14
|
25 * current invocation is the correct one.
|
Chris@14
|
26 *
|
Chris@14
|
27 * The matcher can store information from the invocation which can later
|
Chris@14
|
28 * be checked in verify(), or it can check the values directly and throw
|
Chris@14
|
29 * and exception if an expectation is not met.
|
Chris@14
|
30 *
|
Chris@14
|
31 * If the matcher is a stub it will also have a return value.
|
Chris@14
|
32 *
|
Chris@14
|
33 * @param BaseInvocation $invocation Object containing information on a mocked or stubbed method which was invoked
|
Chris@14
|
34 *
|
Chris@14
|
35 * @return mixed
|
Chris@14
|
36 */
|
Chris@14
|
37 public function invoked(BaseInvocation $invocation);
|
Chris@14
|
38
|
Chris@14
|
39 /**
|
Chris@14
|
40 * Checks if the invocation $invocation matches the current rules. If it does
|
Chris@14
|
41 * the matcher will get the invoked() method called which should check if an
|
Chris@14
|
42 * expectation is met.
|
Chris@14
|
43 *
|
Chris@14
|
44 * @param BaseInvocation $invocation Object containing information on a mocked or stubbed method which was invoked
|
Chris@14
|
45 *
|
Chris@14
|
46 * @return bool
|
Chris@14
|
47 */
|
Chris@14
|
48 public function matches(BaseInvocation $invocation);
|
Chris@14
|
49 }
|