|
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\Schema; |
|
15
|
|
|
|
|
16
|
|
|
use PHPUnit\Framework\TestCase; |
|
17
|
|
|
use Tarantool\Client\Schema\Operations; |
|
18
|
|
|
|
|
19
|
|
|
final class OperationsTest extends TestCase |
|
20
|
|
|
{ |
|
21
|
|
|
public function testAdd() : void |
|
22
|
|
|
{ |
|
23
|
|
|
self::assertSame([['+', 1, 5], ['+', 2, 7]], Operations::add(1, 5)->andAdd(2, 7)->toArray()); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function testSubtract() : void |
|
27
|
|
|
{ |
|
28
|
|
|
self::assertSame([['-', 1, 5], ['-', 2, 7]], Operations::subtract(1, 5)->andSubtract(2, 7)->toArray()); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function testAnd() : void |
|
32
|
|
|
{ |
|
33
|
|
|
self::assertSame([['&', 1, 5], ['&', 2, 7]], Operations::bitAnd(1, 5)->andBitAnd(2, 7)->toArray()); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function testOr() : void |
|
37
|
|
|
{ |
|
38
|
|
|
self::assertSame([['|', 1, 5], ['|', 2, 7]], Operations::bitOr(1, 5)->andBitOr(2, 7)->toArray()); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function testXor() : void |
|
42
|
|
|
{ |
|
43
|
|
|
self::assertSame([['^', 1, 5], ['^', 2, 7]], Operations::bitXor(1, 5)->andBitXor(2, 7)->toArray()); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function testSplice() : void |
|
47
|
|
|
{ |
|
48
|
|
|
self::assertSame([[':', 1, 0, 5, 'foo'], [':', 2, 1, 7, 'bar']], Operations::splice(1, 0, 5, 'foo')->andSplice(2, 1, 7, 'bar')->toArray()); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function testInsert() : void |
|
52
|
|
|
{ |
|
53
|
|
|
self::assertSame([['!', 1, 5], ['!', 2, 7]], Operations::insert(1, 5)->andInsert(2, 7)->toArray()); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function testDelete() : void |
|
57
|
|
|
{ |
|
58
|
|
|
self::assertSame([['#', 1, 5], ['#', 2, 7]], Operations::delete(1, 5)->andDelete(2, 7)->toArray()); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function testSet() : void |
|
62
|
|
|
{ |
|
63
|
|
|
self::assertSame([['=', 1, 5], ['=', 2, 7]], Operations::set(1, 5)->andSet(2, 7)->toArray()); |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|