PacketSyncTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 15
c 2
b 0
f 0
dl 0
loc 29
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSameSync() 0 13 1
A provideValidSync() 0 9 1
1
<?php
2
3
/**
4
 * This file is part of the tarantool/client package.
5
 *
6
 * (c) Eugene Leonovich <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Tarantool\Client\Tests\Integration;
15
16
use Tarantool\Client\Request\PingRequest;
17
18
final class PacketSyncTest extends TestCase
19
{
20
    /**
21
     * @dataProvider provideValidSync
22
     */
23
    public function testSameSync(int $sync) : void
24
    {
25
        $handler = $this->client->getHandler();
0 ignored issues
show
Bug introduced by
The method getHandler() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
        /** @scrutinizer ignore-call */ 
26
        $handler = $this->client->getHandler();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
26
        $connection = $handler->getConnection();
27
        $packer = $handler->getPacker();
28
29
        $packet = $packer->pack(new PingRequest(), $sync);
30
        $connection->open();
31
        $packet = $connection->send($packet);
32
33
        $response = $packer->unpack($packet);
34
35
        self::assertSame($sync, $response->getSync());
36
    }
37
38
    public function provideValidSync() : iterable
39
    {
40
        return [
41
            [0],
42
            [127],
43
            [255],
44
            [65535],
45
            [4294967295],
46
            [9223372036854775807], // PHP_INT_MAX
47
        ];
48
    }
49
}
50