Files
predis/tests/Predis/Command/Argument/TimeSeries/CommonArgumentsTest.php
T
Vladyslav Vildanov 88977fd381 Extended TimeSeries support by implementing TS.MRANGE command (#1233)
* Added support for new arguments for BITPOS, BITCOUNT commands (#1045)

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

* 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

* 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>

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

* Codestyle fixes

* Changed return annotation

* Added support for TS.MRANGE command

---------

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-03-30 09:56:58 +03:00

109 lines
2.6 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\Argument\TimeSeries;
use PHPUnit\Framework\TestCase;
class CommonArgumentsTest extends TestCase
{
/**
* @var CommonArguments
*/
private $arguments;
protected function setUp(): void
{
$this->arguments = new CommonArguments();
}
/**
* @return void
*/
public function testCreatesArgumentsWithRetentionModifier(): void
{
$this->arguments->retentionMsecs(10);
$this->assertSame(['RETENTION', 10], $this->arguments->toArray());
}
/**
* @return void
*/
public function testCreatesArgumentsWithChunkSizeModifier(): void
{
$this->arguments->chunkSize(100);
$this->assertSame(['CHUNK_SIZE', 100], $this->arguments->toArray());
}
/**
* @return void
*/
public function testCreatesArgumentsWithDuplicatePolicyModifier(): void
{
$this->arguments->duplicatePolicy(CommonArguments::POLICY_FIRST);
$this->assertSame(['DUPLICATE_POLICY', CommonArguments::POLICY_FIRST], $this->arguments->toArray());
}
/**
* @return void
*/
public function testCreatesArgumentsWithLabelsModifier(): void
{
$this->arguments->labels('label1', 1, 'label2', 2);
$this->assertSame(['LABELS', 'label1', 1, 'label2', 2], $this->arguments->toArray());
}
/**
* @return void
*/
public function testCreatesArgumentsWithEncodingModifier(): void
{
$this->arguments->encoding(CommonArguments::ENCODING_UNCOMPRESSED);
$this->assertSame(['ENCODING', CommonArguments::ENCODING_UNCOMPRESSED], $this->arguments->toArray());
}
/**
* @return void
*/
public function testCreatesArgumentsWithLatestModifier(): void
{
$this->arguments->latest();
$this->assertSame(['LATEST'], $this->arguments->toArray());
}
/**
* @return void
*/
public function testCreatesArgumentsWithWithLabelsModifier(): void
{
$this->arguments->withLabels();
$this->assertSame(['WITHLABELS'], $this->arguments->toArray());
}
/**
* @return void
*/
public function testCreatesArgumentsWithSelectedLabelsModifier(): void
{
$this->arguments->selectedLabels('label1', 'label2');
$this->assertSame(['SELECTED_LABELS', 'label1', 'label2'], $this->arguments->toArray());
}
}