Files
predis/tests/Predis/Command/StringSetPreserveTest.php
T
Daniele Alessandri 00247abc50 [tests] Add missing tests for SETNX.
For some obscure reason Predis/Command/StringSetPreserve had no tests.
2013-11-29 22:50:09 +01:00

72 lines
1.4 KiB
PHP

<?php
/*
* This file is part of the Predis package.
*
* (c) Daniele Alessandri <suppakilla@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command;
use PHPUnit_Framework_TestCase as StandardTestCase;
/**
* @group commands
* @group realm-string
*/
class StringSetPreserveTest extends CommandTestCase
{
/**
* {@inheritdoc}
*/
protected function getExpectedCommand()
{
return 'Predis\Command\StringSetPreserve';
}
/**
* {@inheritdoc}
*/
protected function getExpectedId()
{
return 'SETNX';
}
/**
* @group disconnected
*/
public function testFilterArguments()
{
$arguments = array('foo', 'bar');
$expected = array('foo', 'bar');
$command = $this->getCommand();
$command->setArguments($arguments);
$this->assertSame($expected, $command->getArguments());
}
/**
* @group disconnected
*/
public function testParseResponse()
{
$this->assertTrue($this->getCommand()->parseResponse(1));
}
/**
* @group connected
*/
public function testSetStringValue()
{
$redis = $this->getClient();
$this->assertTrue($redis->setnx('foo', 'bar'));
$this->assertFalse($redis->setnx('foo', 'barbar'));
$this->assertEquals('bar', $redis->get('foo'));
}
}