Passed
Push — master ( c944ae...cfc925 )
by Eugene
06:58
created

OperationsTest   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 45
rs 10
c 3
b 0
f 0
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A testSet() 0 3 1
A testAdd() 0 3 1
A testDelete() 0 3 1
A testInsert() 0 3 1
A testSplice() 0 3 1
A testSubtract() 0 3 1
A testAnd() 0 3 1
A testBitwiseXor() 0 3 1
A testBitwiseOr() 0 3 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\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::bitwiseAnd(1, 5)->andBitwiseAnd(2, 7)->toArray());
34
    }
35
36
    public function testBitwiseOr() : void
37
    {
38
        self::assertSame([['|', 1, 5], ['|', 2, 7]], Operations::bitwiseOr(1, 5)->andBitwiseOr(2, 7)->toArray());
39
    }
40
41
    public function testBitwiseXor() : void
42
    {
43
        self::assertSame([['^', 1, 5], ['^', 2, 7]], Operations::bitwiseXor(1, 5)->andBitwiseXor(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