Completed
Pull Request — master (#1851)
by
unknown
02:27
created

ChainProcessorTest::testProcessor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Elastica\Test\ResultSet;
4
5
use Elastica\Query;
6
use Elastica\Response;
7
use Elastica\ResultSet;
8
use Elastica\ResultSet\ChainProcessor;
9
use Elastica\ResultSet\ProcessorInterface;
10
use Elastica\Test\Base as BaseTest;
11
12
/**
13
 * @group unit
14
 *
15
 * @internal
16
 */
17
class ChainProcessorTest extends BaseTest
18
{
19
    public function testProcessor(): void
20
    {
21
        $processor = new ChainProcessor([
0 ignored issues
show
Documentation introduced by
array($processor1 = $thi...essorInterface::class)) is of type array<integer,object<PHP...kObject\\MockObject>"}>, but the function expects a array<integer,object<Ela...et\ProcessorInterface>>.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
22
            $processor1 = $this->createMock(ProcessorInterface::class),
23
            $processor2 = $this->createMock(ProcessorInterface::class),
24
        ]);
25
        $resultSet = new ResultSet(new Response(''), new Query(), []);
26
27
        $processor1->expects($this->once())
28
            ->method('process')
29
            ->with($resultSet)
30
        ;
31
        $processor2->expects($this->once())
32
            ->method('process')
33
            ->with($resultSet)
34
        ;
35
36
        $processor->process($resultSet);
37
    }
38
}
39