Files
predis/tests/Predis/Command/Redis/SELECT_Test.php
T
Vladyslav Vildanov 3caa973214 Added support for RediSearch, implemented FT.CREATE command (#1143)
* Added support for new arguments for BITPOS, BITCOUNT commands (#1045)

* Added support for new arguments for EXPIRE, EXPIREAT commands (#1046)

* add support for CF.ADDNX

* Extended core support by implementing SORT_RO command (#1044)

* Added support for SORT_RO command

* Codestyle fixes

* Added command description

---------

Co-authored-by: Vladyslav Vildanov <vladyslavvildanov@Vladyslav-Vildanov-MacBook-Pro.local>

* fix deprecated call

* fix key name

* fix wrong command

* Added support for container commands (#1049)

* Added support for container commands FUNCTION LOAD, FUNCTION DELETE and FCALL

* Changed ContainerInterface and AbstractContainer

* Re-implement logic of abstract methods

---------

Co-authored-by: Vladyslav Vildanov <vladyslavvildanov@Vladyslav-Vildanov-MacBook-Pro.local>

* Added stream commands to KeyPrefixProcessor (#1051)

Co-authored-by: Vladyslav Vildanov <vladyslavvildanov@Vladyslav-Vildanov-MacBook-Pro.local>

* Pulling changes

* Fix return type of ReplicationInterface::getSlaves (#1111)

* Added support for FT.CREATE command

* Fixed tests to choose correct DB

* Added test coverage

* Revert changes for missing commands

* Added data types enums, added methods default assignments

* Fixed vector field, removed default assignments, fixed tests

* Added constants enum for Sortable argument, renamed arguments object

* Codestyle fixes

* Rename test class

* Codestyle fixes

* Changed return annotation

* Separate common and create interfaces

* Codestyle fixes

* Revert changes

---------

Co-authored-by: shacharPash <shachar.pashchur@redis.com>
Co-authored-by: Vladyslav Vildanov <vladyslavvildanov@Vladyslav-Vildanov-MacBook-Pro.local>
Co-authored-by: Till Krüss <till@kruss.io>
Co-authored-by: Stephan <glaubinix@users.noreply.github.com>
2023-02-21 17:55:58 +02:00

98 lines
2.1 KiB
PHP

<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Redis;
/**
* @group commands
* @group realm-connection
*/
class SELECT_Test extends PredisCommandTestCase
{
/**
* {@inheritdoc}
*/
protected function getExpectedCommand(): string
{
return 'Predis\Command\Redis\SELECT';
}
/**
* {@inheritdoc}
*/
protected function getExpectedId(): string
{
return 'SELECT';
}
/**
* @group disconnected
*/
public function testFilterArguments(): void
{
$arguments = [10];
$expected = [10];
$command = $this->getCommand();
$command->setArguments($arguments);
$this->assertSame($expected, $command->getArguments());
}
/**
* @group disconnected
*/
public function testParseResponse(): void
{
$this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
}
/**
* @group connected
*/
public function testCanSelectDifferentDatabase(): void
{
$redis = $this->getClient();
$redis->set('foo', 'bar');
$this->assertEquals('OK', $redis->select(REDIS_SERVER_DBNUM + 1));
$this->assertSame(0, $redis->exists('foo'));
}
/**
* @group connected
*/
public function testThrowsExceptionOnUnexpectedDatabaseRange(): void
{
$this->expectException('Predis\Response\ServerException');
$this->expectExceptionMessageMatches('/ERR.*DB index/');
$redis = $this->getClient();
$redis->select(100000000);
}
/**
* @group connected
*/
public function testThrowsExceptionOnUnexpectedDatabaseName(): void
{
$this->expectException('Predis\Response\ServerException');
$this->expectExceptionMessageMatches('/ERR.*(invalid DB index|value is not an integer or out of range)/');
$redis = $this->getClient();
$redis->select('x');
}
}