Passed
Push — master ( 7fdb18...75e880 )
by Eugene
05:04
created

PacketSyncTest::provideValidSync()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
rs 10
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();
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
            [128],
43
            [65535],
44
            [4294967295],
45
            [9223372036854775807], // PHP_INT_MAX
46
        ];
47
    }
48
}
49