Issues (55)

tests/Integration/Requests/DeleteTest.php (1 issue)

Labels
Severity
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\Requests;
15
16
use Tarantool\Client\Exception\RequestFailed;
17
use Tarantool\Client\Tests\Integration\TestCase;
18
19
/**
20
 * @lua space = create_space('request_delete')
21
 * @lua space:create_index('primary', {type = 'hash', parts = {1, 'unsigned'}})
22
 * @lua space:create_index('secondary', {type = 'tree', parts = {2, 'str'}})
23
 * @lua space:insert{3, 'delete_me_1'}
24
 * @lua space:insert{4, 'delete_me_2'}
25
 * @lua space:insert{5, 'delete_me_3'}
26
 */
27
final class DeleteTest extends TestCase
28
{
29
    public function testDelete() : void
30
    {
31
        $space = $this->client->getSpace('request_delete');
0 ignored issues
show
The method getSpace() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

31
        /** @scrutinizer ignore-call */ 
32
        $space = $this->client->getSpace('request_delete');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
        $result = $space->delete([3]);
33
34
        self::assertSame([[3, 'delete_me_1']], $result);
35
    }
36
37
    public function testDeleteWithIndexId() : void
38
    {
39
        $space = $this->client->getSpace('request_delete');
40
        $result = $space->delete(['delete_me_2'], 1);
41
42
        self::assertSame([[4, 'delete_me_2']], $result);
43
    }
44
45
    public function testDeleteWithIndexName() : void
46
    {
47
        $space = $this->client->getSpace('request_delete');
48
        $result = $space->delete(['delete_me_3'], 'secondary');
49
50
        self::assertSame([[5, 'delete_me_3']], $result);
51
    }
52
53
    public function testDeleteByEmptyKey() : void
54
    {
55
        $space = $this->client->getSpace('request_delete');
56
57
        $this->expectException(RequestFailed::class);
58
        $this->expectExceptionCode(19); // ER_EXACT_MATCH
59
60
        $space->delete([]);
61
    }
62
}
63