1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Liip\MonitorBundle\Tests; |
4
|
|
|
|
5
|
|
|
use Laminas\Diagnostics\Runner\Reporter\ReporterInterface; |
6
|
|
|
use Liip\MonitorBundle\Runner; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @author Kevin Bond <[email protected]> |
10
|
|
|
*/ |
11
|
|
|
class RunnerTest extends \PHPUnit\Framework\TestCase |
12
|
|
|
{ |
13
|
|
|
public function testAdditionalReporters() |
14
|
|
|
{ |
15
|
|
|
$runner = new Runner(); |
16
|
|
|
|
17
|
|
|
$this->assertCount(0, $runner->getReporters()); |
|
|
|
|
18
|
|
|
|
19
|
|
|
$runner->addAdditionalReporter('foo', $this->createMockReporter()); |
|
|
|
|
20
|
|
|
$runner->addAdditionalReporter('bar', $this->createMockReporter()); |
|
|
|
|
21
|
|
|
|
22
|
|
|
$this->assertCount(0, $runner->getReporters()); |
|
|
|
|
23
|
|
|
|
24
|
|
|
$runner->useAdditionalReporters(['baz']); |
25
|
|
|
|
26
|
|
|
$this->assertCount(0, $runner->getReporters()); |
|
|
|
|
27
|
|
|
|
28
|
|
|
$runner->useAdditionalReporters(['foo']); |
29
|
|
|
|
30
|
|
|
$this->assertCount(1, $runner->getReporters()); |
|
|
|
|
31
|
|
|
|
32
|
|
|
$runner->useAdditionalReporters(['bar']); |
33
|
|
|
|
34
|
|
|
$this->assertCount(2, $runner->getReporters()); |
|
|
|
|
35
|
|
|
|
36
|
|
|
$runner = new Runner(); |
37
|
|
|
$runner->addAdditionalReporter('foo', $this->createMockReporter()); |
|
|
|
|
38
|
|
|
$runner->addAdditionalReporter('bar', $this->createMockReporter()); |
|
|
|
|
39
|
|
|
$runner->useAdditionalReporters(['bar', 'foo']); |
40
|
|
|
|
41
|
|
|
$this->assertCount(2, $runner->getReporters()); |
|
|
|
|
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @return ReporterInterface |
46
|
|
|
*/ |
47
|
|
|
private function createMockReporter() |
48
|
|
|
{ |
49
|
|
|
return $this->getMockBuilder(ReporterInterface::class)->getMock(); |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: