Passed
Pull Request — master (#63)
by Eugene
06:42
created

ClientSpaceCachingTest::testFlushSpaces()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 10
rs 10
c 1
b 0
f 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\Integration;
15
16
use Tarantool\Client\Schema\Criteria;
17
18
/**
19
 * @eval create_space('test_space_caching'):create_index('primary', {type = 'tree', parts = {1, 'unsigned'}})
20
 */
21
final class ClientSpaceCachingTest extends TestCase
22
{
23
    public function testCacheSpace() : void
24
    {
25
        $total = self::getTotalCalls(self::STAT_REQUEST_SELECT);
26
27
        $this->client->flushSpaces();
28
        $this->client->getSpace('test_space_caching')->select(Criteria::key([]));
29
        $this->client->getSpace('test_space_caching')->select(Criteria::key([]));
30
31
        self::assertSame(3, self::getTotalCalls(self::STAT_REQUEST_SELECT) - $total);
32
    }
33
34
    public function testFlushSpaces() : void
35
    {
36
        $total = self::getTotalCalls(self::STAT_REQUEST_SELECT);
37
38
        $this->client->flushSpaces();
39
        $this->client->getSpace('test_space_caching')->select(Criteria::key([]));
40
        $this->client->flushSpaces();
41
        $this->client->getSpace('test_space_caching')->select(Criteria::key([]));
42
43
        self::assertSame(4, self::getTotalCalls(self::STAT_REQUEST_SELECT) - $total);
44
    }
45
}
46