Passed
Push — master ( b091a1...a43e6f )
by Pavel
03:13
created

RpcClientTest::getStaticIdGenerator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace ScayTrase\Api\JsonRpc\Tests;
4
5
use GuzzleHttp\Psr7\Uri;
6
use Prophecy\Argument;
7
use ScayTrase\Api\IdGenerator\IdGeneratorInterface;
8
use ScayTrase\Api\JsonRpc\JsonRpcClient;
9
use ScayTrase\Api\Rpc\Tests\RpcRequestTrait;
10
11
final class RpcClientTest extends AbstractJsonRpcClientTest
12
{
13
    use RpcRequestTrait;
14
15
    const REQUEST_ID = 'request_id';
16
17
    public function testRpcRequestHandling()
18
    {
19
        $request = $this->getRequestMock('test', ['param1' => 'value1']);
20
        $client = new JsonRpcClient($this->getClient(), new Uri(), $this->getStaticIdGenerator(self::REQUEST_ID));
21
22
        $this->pushResult((object)['success' => true], self::REQUEST_ID);
23
24
        $collection = $client->invoke($request);
25
        $response = $collection->getResponse($request);
0 ignored issues
show
Unused Code introduced by
$response is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
26
    }
27
28
    public function getStaticIdGenerator($id)
29
    {
30
        $generator = $this->prophesize(IdGeneratorInterface::class);
31
        $generator->getRequestIdentifier(Argument::any())->willReturn($id);
32
33
        return $generator->reveal();
34
    }
35
}
36