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\Unit\Connection; |
15
|
|
|
|
16
|
|
|
use PHPUnit\Framework\TestCase; |
17
|
|
|
use Tarantool\Client\Connection\Greeting; |
18
|
|
|
|
19
|
|
|
final class GreetingTest extends TestCase |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @dataProvider \Tarantool\Client\Tests\GreetingDataProvider::provideValidGreetings |
23
|
|
|
*/ |
24
|
|
|
public function testGetSalt(string $greeting, string $salt) : void |
25
|
|
|
{ |
26
|
|
|
self::assertSame($salt, Greeting::parse($greeting)->getSalt()); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @dataProvider provideServerVersions |
31
|
|
|
*/ |
32
|
|
|
public function testGetServerVersion(string $greeting, int $expectedVersion) : void |
33
|
|
|
{ |
34
|
|
|
self::assertSame($expectedVersion, Greeting::parse($greeting)->getServerVersionId()); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function provideServerVersions() : iterable |
38
|
|
|
{ |
39
|
|
|
return [ |
40
|
|
|
['Tarantool foobar', 0], |
41
|
|
|
['Tarantool 0.0.2', 2], |
42
|
|
|
['Tarantool 0.2.0', 200], |
43
|
|
|
['Tarantool 0.2.2', 202], |
44
|
|
|
['Tarantool 2.0.0', 20000], |
45
|
|
|
['Tarantool 2.0.2', 20002], |
46
|
|
|
['Tarantool 2.2.0', 20200], |
47
|
|
|
['Tarantool 2.2.2', 20202], |
48
|
|
|
['Tarantool 10.20.30', 102030], |
49
|
|
|
]; |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|