mirror of
https://github.com/predis/predis.git
synced 2026-09-16 05:17:02 +00:00
Rename Predis\Client::multiExec() to Predis\Client::transaction().
Method was deprecated since Predis v0.8.5.
This commit is contained in:
@@ -33,7 +33,7 @@ function zpop($client, $key)
|
||||
// which the client bails out with an exception.
|
||||
);
|
||||
|
||||
$client->multiExec($options, function ($tx) use ($key, &$element) {
|
||||
$client->transaction($options, function ($tx) use ($key, &$element) {
|
||||
@list($element) = $tx->zrange($key, 0, 0);
|
||||
|
||||
if (isset($element)) {
|
||||
@@ -361,9 +361,9 @@ class Client implements ClientInterface
|
||||
* @param mixed $arg,... Options for the context, a callable object, or both.
|
||||
* @return MultiExecContext|array
|
||||
*/
|
||||
public function multiExec(/* arguments */)
|
||||
public function transaction(/* arguments */)
|
||||
{
|
||||
return $this->sharedContextFactory('createMultiExec', func_get_args());
|
||||
return $this->sharedContextFactory('createTransaction', func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -373,7 +373,7 @@ class Client implements ClientInterface
|
||||
* @param mixed $callable Optional callable object used to execute the context.
|
||||
* @return MultiExecContext|array
|
||||
*/
|
||||
protected function createMultiExec(Array $options = null, $callable = null)
|
||||
protected function createTransaction(Array $options = null, $callable = null)
|
||||
{
|
||||
$transaction = new MultiExecContext($this, $options ?: array());
|
||||
return isset($callable) ? $transaction->execute($callable) : $transaction;
|
||||
|
||||
@@ -635,23 +635,23 @@ class ClientTest extends StandardTestCase
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testMultiExecWithoutArgumentsReturnsMultiExecContext()
|
||||
public function testTransactionWithoutArgumentsReturnsMultiExecContext()
|
||||
{
|
||||
$client = new Client();
|
||||
|
||||
$this->assertInstanceOf('Predis\Transaction\MultiExecContext', $client->multiExec());
|
||||
$this->assertInstanceOf('Predis\Transaction\MultiExecContext', $client->transaction());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testMultiExecWithArrayReturnsMultiExecContextWithOptions()
|
||||
public function testTransactionWithArrayReturnsMultiExecContextWithOptions()
|
||||
{
|
||||
$options = array('cas' => true, 'retry' => 3);
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$this->assertInstanceOf('Predis\Transaction\MultiExecContext', $tx = $client->multiExec($options));
|
||||
$this->assertInstanceOf('Predis\Transaction\MultiExecContext', $tx = $client->transaction($options));
|
||||
|
||||
$reflection = new \ReflectionProperty($tx, 'options');
|
||||
$reflection->setAccessible(true);
|
||||
@@ -662,7 +662,7 @@ class ClientTest extends StandardTestCase
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testMultiExecWithArrayAndCallableExecutesMultiExec()
|
||||
public function testTransactionWithArrayAndCallableExecutesMultiExec()
|
||||
{
|
||||
// NOTE: we use CAS since testing the actual MULTI/EXEC context
|
||||
// here is not the point.
|
||||
@@ -683,7 +683,7 @@ class ClientTest extends StandardTestCase
|
||||
->will($this->returnCallback($txCallback));
|
||||
|
||||
$client = new Client($connection);
|
||||
$client->multiExec($options, $callable);
|
||||
$client->transaction($options, $callable);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -483,7 +483,7 @@ class MultiExecContextTest extends StandardTestCase
|
||||
$exception = null;
|
||||
|
||||
try {
|
||||
$client->multiExec(function ($tx) {
|
||||
$client->transaction(function ($tx) {
|
||||
$tx->set('foo', 'bar');
|
||||
throw new \RuntimeException("TEST");
|
||||
});
|
||||
@@ -505,7 +505,7 @@ class MultiExecContextTest extends StandardTestCase
|
||||
$value = (string) rand();
|
||||
|
||||
try {
|
||||
$client->multiExec(function ($tx) use ($value) {
|
||||
$client->transaction(function ($tx) use ($value) {
|
||||
$tx->set('foo', 'bar');
|
||||
$tx->lpush('foo', 'bar');
|
||||
$tx->set('foo', $value);
|
||||
@@ -525,7 +525,7 @@ class MultiExecContextTest extends StandardTestCase
|
||||
{
|
||||
$client = $this->getClient(array(), array('exceptions' => false));
|
||||
|
||||
$replies = $client->multiExec(function ($tx) {
|
||||
$replies = $client->transaction(function ($tx) {
|
||||
$tx->set('foo', 'bar');
|
||||
$tx->lpush('foo', 'bar');
|
||||
$tx->echo('foobar');
|
||||
@@ -543,7 +543,7 @@ class MultiExecContextTest extends StandardTestCase
|
||||
{
|
||||
$client = $this->getClient();
|
||||
|
||||
$replies = $client->multiExec(function ($tx) {
|
||||
$replies = $client->transaction(function ($tx) {
|
||||
$tx->set('foo', 'bar');
|
||||
$tx->discard();
|
||||
$tx->set('hoge', 'piyo');
|
||||
@@ -564,7 +564,7 @@ class MultiExecContextTest extends StandardTestCase
|
||||
$client2 = $this->getClient();
|
||||
|
||||
try {
|
||||
$client1->multiExec(array('watch' => 'sentinel'), function ($tx) use ($client2) {
|
||||
$client1->transaction(array('watch' => 'sentinel'), function ($tx) use ($client2) {
|
||||
$tx->set('sentinel', 'client1');
|
||||
$tx->get('sentinel');
|
||||
$client2->set('sentinel', 'client2');
|
||||
@@ -587,7 +587,7 @@ class MultiExecContextTest extends StandardTestCase
|
||||
$client->set('foo', 'bar');
|
||||
$options = array('watch' => 'foo', 'cas' => true);
|
||||
|
||||
$replies = $client->multiExec($options, function ($tx) {
|
||||
$replies = $client->transaction($options, function ($tx) {
|
||||
$tx->watch('foobar');
|
||||
$foo = $tx->get('foo');
|
||||
|
||||
@@ -605,7 +605,7 @@ class MultiExecContextTest extends StandardTestCase
|
||||
$client->set('foo', 'bar');
|
||||
|
||||
$options = array('watch' => 'foo', 'cas' => true, 'retry' => 1);
|
||||
$replies = $client->multiExec($options, function ($tx) use ($client2, &$hijack) {
|
||||
$replies = $client->transaction($options, function ($tx) use ($client2, &$hijack) {
|
||||
$foo = $tx->get('foo');
|
||||
$tx->multi();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user