Mercurial > hg > isophonics-drupal-site
comparison vendor/phpunit/phpunit-mock-objects/src/Matcher/InvokedRecorder.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
1 <?php | |
2 /* | |
3 * This file is part of the phpunit-mock-objects package. | |
4 * | |
5 * (c) Sebastian Bergmann <sebastian@phpunit.de> | |
6 * | |
7 * For the full copyright and license information, please view the LICENSE | |
8 * file that was distributed with this source code. | |
9 */ | |
10 namespace PHPUnit\Framework\MockObject\Matcher; | |
11 | |
12 use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; | |
13 | |
14 /** | |
15 * Records invocations and provides convenience methods for checking them later | |
16 * on. | |
17 * This abstract class can be implemented by matchers which needs to check the | |
18 * number of times an invocation has occurred. | |
19 */ | |
20 abstract class InvokedRecorder implements Invocation | |
21 { | |
22 /** | |
23 * @var BaseInvocation[] | |
24 */ | |
25 private $invocations = []; | |
26 | |
27 /** | |
28 * @return int | |
29 */ | |
30 public function getInvocationCount() | |
31 { | |
32 return \count($this->invocations); | |
33 } | |
34 | |
35 /** | |
36 * @return BaseInvocation[] | |
37 */ | |
38 public function getInvocations() | |
39 { | |
40 return $this->invocations; | |
41 } | |
42 | |
43 /** | |
44 * @return bool | |
45 */ | |
46 public function hasBeenInvoked() | |
47 { | |
48 return \count($this->invocations) > 0; | |
49 } | |
50 | |
51 /** | |
52 * @param BaseInvocation $invocation | |
53 */ | |
54 public function invoked(BaseInvocation $invocation) | |
55 { | |
56 $this->invocations[] = $invocation; | |
57 } | |
58 | |
59 /** | |
60 * @param BaseInvocation $invocation | |
61 * | |
62 * @return bool | |
63 */ | |
64 public function matches(BaseInvocation $invocation) | |
65 { | |
66 return true; | |
67 } | |
68 } |