mirror of
https://github.com/predis/predis.git
synced 2026-09-15 21:07:08 +00:00
Move classes related to MULTI/EXEC abstraction to the Predis\Transaction namespace.
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Predis;
|
||||
|
||||
class AbortedMultiExec extends PredisException {
|
||||
// Aborted MULTI/EXEC transactions
|
||||
}
|
||||
@@ -8,6 +8,7 @@ use Predis\Network\IConnectionSingle;
|
||||
use Predis\Profiles\IServerProfile;
|
||||
use Predis\Profiles\ServerProfile;
|
||||
use Predis\Pipeline\PipelineContext;
|
||||
use Predis\Transaction\MultiExecContext;
|
||||
|
||||
class Client {
|
||||
const VERSION = '0.7.0-dev';
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Predis\Transaction;
|
||||
|
||||
use Predis\PredisException;
|
||||
|
||||
class AbortedMultiExecException extends PredisException {
|
||||
// Aborted MULTI/EXEC transactions
|
||||
}
|
||||
@@ -1,6 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Predis;
|
||||
namespace Predis\Transaction;
|
||||
|
||||
use Predis\Client;
|
||||
use Predis\Helpers;
|
||||
use Predis\ResponseQueued;
|
||||
use Predis\ClientException;
|
||||
use Predis\ServerException;
|
||||
use Predis\ProtocolException;
|
||||
use Predis\CommunicationException;
|
||||
|
||||
class MultiExecContext {
|
||||
private $_initialized, $_discarded, $_insideBlock, $_checkAndSet, $_watchedKeys;
|
||||
@@ -186,7 +194,7 @@ class MultiExecContext {
|
||||
$reply = $this->_client->exec();
|
||||
if ($reply === null) {
|
||||
if ($attemptsLeft === 0) {
|
||||
throw new AbortedMultiExec(
|
||||
throw new AbortedMultiExecException(
|
||||
'The current transaction has been aborted by the server'
|
||||
);
|
||||
}
|
||||
@@ -486,14 +486,15 @@ class ClientFeaturesTestSuite extends PHPUnit_Framework_TestCase {
|
||||
$client->flushdb();
|
||||
|
||||
$multi = $client->multiExec();
|
||||
$transactionClass = '\Predis\Transaction\MultiExecContext';
|
||||
|
||||
$this->assertInstanceOf('\Predis\MultiExecContext', $multi);
|
||||
$this->assertInstanceOf('\Predis\MultiExecContext', $multi->set('foo', 'bar'));
|
||||
$this->assertInstanceOf('\Predis\MultiExecContext', $multi->set('hoge', 'piyo'));
|
||||
$this->assertInstanceOf('\Predis\MultiExecContext', $multi->mset(array(
|
||||
$this->assertInstanceOf($transactionClass, $multi);
|
||||
$this->assertInstanceOf($transactionClass, $multi->set('foo', 'bar'));
|
||||
$this->assertInstanceOf($transactionClass, $multi->set('hoge', 'piyo'));
|
||||
$this->assertInstanceOf($transactionClass, $multi->mset(array(
|
||||
'foofoo' => 'barbar', 'hogehoge' => 'piyopiyo'
|
||||
)));
|
||||
$this->assertInstanceOf('\Predis\MultiExecContext', $multi->mget(array(
|
||||
$this->assertInstanceOf($transactionClass, $multi->mget(array(
|
||||
'foo', 'hoge', 'foofoo', 'hogehoge'
|
||||
)));
|
||||
|
||||
|
||||
@@ -168,10 +168,10 @@ class RC {
|
||||
try {
|
||||
$wrapFunction($testcaseInstance);
|
||||
}
|
||||
catch (Predis\AbortedMultiExec $exception) {
|
||||
catch (Predis\Transaction\AbortedMultiExecException $exception) {
|
||||
$thrownException = $exception;
|
||||
}
|
||||
$testcaseInstance->assertInstanceOf('Predis\AbortedMultiExec', $thrownException);
|
||||
$testcaseInstance->assertInstanceOf('Predis\Transaction\AbortedMultiExecException', $thrownException);
|
||||
}
|
||||
|
||||
public static function pushTailAndReturn(Predis\Client $client, $keyName, Array $values, $wipeOut = 0) {
|
||||
|
||||
Reference in New Issue
Block a user