123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- namespace Predis\Commands;
- use \PHPUnit_Framework_TestCase as StandardTestCase;
- class TransactionMultiTest extends CommandTestCase
- {
-
- protected function getExpectedCommand()
- {
- return 'Predis\Commands\TransactionMulti';
- }
-
- protected function getExpectedId()
- {
- return 'MULTI';
- }
-
- public function testFilterArguments()
- {
- $command = $this->getCommand();
- $command->setArguments(array());
- $this->assertSame(array(), $command->getArguments());
- }
-
- public function testParseResponse()
- {
- $this->assertTrue($this->getCommand()->parseResponse(true));
- }
-
- public function testInitializesNewTransaction()
- {
- $redis = $this->getClient();
- $this->assertTrue($redis->multi());
- $this->assertSame('QUEUED', (string) $redis->echo('tx1'));
- $this->assertSame('QUEUED', (string) $redis->echo('tx2'));
- }
-
- public function testActuallyReturnsReplyObjectAbstraction()
- {
- $redis = $this->getClient();
- $this->assertTrue($redis->multi());
- $this->assertInstanceOf('Predis\IReplyObject', $redis->echo('tx1'));
- $this->assertInstanceOf('Predis\ResponseQueued', $redis->echo('tx2'));
- }
-
- public function testThrowsExceptionWhenCallingMultiInsideTransaction()
- {
- $redis = $this->getClient();
- $redis->multi();
- $redis->multi();
- }
- }
|