Passed
Pull Request — master (#63)
by Eugene
03:45
created

OperationsTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 22
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testOperations() 0 3 1
A provideOperationsData() 0 12 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
    /**
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