123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- namespace Predis\Command;
- class KeyPersistTest extends PredisCommandTestCase
- {
-
- protected function getExpectedCommand()
- {
- return 'Predis\Command\KeyPersist';
- }
-
- protected function getExpectedId()
- {
- return 'PERSIST';
- }
-
- public function testFilterArguments()
- {
- $arguments = array('key');
- $expected = array('key');
- $command = $this->getCommand();
- $command->setArguments($arguments);
- $this->assertSame($expected, $command->getArguments());
- }
-
- public function testParseResponse()
- {
- $command = $this->getCommand();
- $this->assertTrue($command->parseResponse(1));
- $this->assertFalse($command->parseResponse(0));
- }
-
- public function testRemovesExpireFromKey()
- {
- $redis = $this->getClient();
- $redis->set('foo', 'bar');
- $redis->expire('foo', 10);
- $this->assertTrue($redis->persist('foo'));
- $this->assertSame(-1, $redis->ttl('foo'));
- }
-
- public function testReturnsFalseOnNonExpiringKeys()
- {
- $redis = $this->getClient();
- $redis->set('foo', 'bar');
- $this->assertFalse($redis->persist('foo'));
- }
-
- public function testReturnsFalseOnNonExistentKeys()
- {
- $redis = $this->getClient();
- $this->assertFalse($redis->persist('foo'));
- }
- }
|