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
|
|
|
/** |
22
|
|
|
* @dataProvider provideOperationsData |
23
|
|
|
*/ |
24
|
|
|
public function testOperations(array $resultArray, Operations $operations) : void |
25
|
|
|
{ |
26
|
|
|
self::assertSame($resultArray, $operations->toArray()); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function provideOperationsData() : iterable |
30
|
|
|
{ |
31
|
|
|
return [ |
32
|
|
|
[[['+', 1, 5], ['+', 2, 7]], Operations::add(1, 5)->andAdd(2, 7)], |
33
|
|
|
[[['-', 1, 5], ['-', 2, 7]], Operations::subtract(1, 5)->andSubtract(2, 7)], |
34
|
|
|
[[['&', 1, 5], ['&', 2, 7]], Operations::bitAnd(1, 5)->andBitAnd(2, 7)], |
35
|
|
|
[[['|', 1, 5], ['|', 2, 7]], Operations::bitOr(1, 5)->andBitOr(2, 7)], |
36
|
|
|
[[['^', 1, 5], ['^', 2, 7]], Operations::bitXor(1, 5)->andBitXor(2, 7)], |
37
|
|
|
[[[':', 1, 0, 5, 'foo'], [':', 2, 1, 7, 'bar']], Operations::splice(1, 0, 5, 'foo')->andSplice(2, 1, 7, 'bar')], |
38
|
|
|
[[['!', 1, 5], ['!', 2, 7]], Operations::insert(1, 5)->andInsert(2, 7)], |
39
|
|
|
[[['#', 1, 5], ['#', 2, 7]], Operations::delete(1, 5)->andDelete(2, 7)], |
40
|
|
|
[[['=', 1, 5], ['=', 2, 7]], Operations::set(1, 5)->andSet(2, 7)], |
41
|
|
|
]; |
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
|