Issues (55)

tests/Integration/Requests/ReplaceTest.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\Schema\Criteria;
18
use Tarantool\Client\Tests\Integration\TestCase;
19
20
/**
21
 * @lua space = create_space('request_replace')
22
 * @lua space:create_index('primary', {type = 'hash', parts = {1, 'unsigned'}})
23
 * @lua space:create_index('secondary', {type = 'tree', parts = {2, 'str'}})
24
 * @lua space:insert{2, 'replace_me'}
25
 */
26
final class ReplaceTest extends TestCase
27
{
28
    public function testReplace() : void
29
    {
30
        $space = $this->client->getSpace('request_replace');
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

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

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...
31
32
        self::assertSame([[2, 'replace_me']], $space->select(Criteria::key([2])));
33
        self::assertSame([[2, 'replaced']], $space->replace([2, 'replaced']));
34
    }
35
36
    public function testReplaceEmptyTuple() : void
37
    {
38
        $space = $this->client->getSpace('request_replace');
39
40
        $this->expectException(RequestFailed::class);
41
        $this->expectExceptionCode(39); // ER_FIELD_MISSING
42
43
        $space->replace([]);
44
    }
45
}
46