12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace Predis\Command;
- class SetPopTest extends PredisCommandTestCase
- {
-
- protected function getExpectedCommand()
- {
- return 'Predis\Command\SetPop';
- }
-
- protected function getExpectedId()
- {
- return 'SPOP';
- }
-
- public function testFilterArguments()
- {
- $arguments = array('key');
- $expected = array('key');
- $command = $this->getCommand();
- $command->setArguments($arguments);
- $this->assertSame($expected, $command->getArguments());
- }
-
- public function testParseResponse()
- {
- $this->assertSame('member', $this->getCommand()->parseResponse('member'));
- }
-
- public function testPopsRandomMemberFromSet()
- {
- $redis = $this->getClient();
- $redis->sadd('letters', 'a', 'b');
- $this->assertContains($redis->spop('letters'), array('a', 'b'));
- $this->assertContains($redis->spop('letters'), array('a', 'b'));
- $this->assertNull($redis->spop('letters'));
- }
-
- public function testThrowsExceptionOnWrongType()
- {
- $redis = $this->getClient();
- $redis->set('foo', 'bar');
- $redis->spop('foo');
- }
- }
|