|
@@ -89,6 +89,8 @@ class MultiExecContextTest extends PredisTestCase
|
|
|
*/
|
|
|
public function testCannotMixExecutionWithFluentInterfaceAndCallable()
|
|
|
{
|
|
|
+ $exception = null;
|
|
|
+
|
|
|
$commands = array();
|
|
|
|
|
|
$callback = $this->getExecuteCallback(null, $commands);
|
|
@@ -100,8 +102,8 @@ class MultiExecContextTest extends PredisTestCase
|
|
|
$tx->echo('foo')->execute(function ($tx) {
|
|
|
$tx->echo('bar');
|
|
|
});
|
|
|
- } catch (\Exception $ex) {
|
|
|
- $exception = $ex;
|
|
|
+ } catch (\Exception $exception) {
|
|
|
+ // NOOP
|
|
|
}
|
|
|
|
|
|
$this->assertInstanceOf('Predis\ClientException', $exception);
|
|
@@ -419,6 +421,8 @@ class MultiExecContextTest extends PredisTestCase
|
|
|
*/
|
|
|
public function testHandlesStandardExceptionsInBlock()
|
|
|
{
|
|
|
+ $exception = null;
|
|
|
+
|
|
|
$commands = array();
|
|
|
$expected = array('foobar', true);
|
|
|
|
|
@@ -434,7 +438,7 @@ class MultiExecContextTest extends PredisTestCase
|
|
|
|
|
|
throw new \RuntimeException('TEST');
|
|
|
});
|
|
|
- } catch (\Exception $ex) {
|
|
|
+ } catch (\Exception $exception) {
|
|
|
// NOOP
|
|
|
}
|
|
|
|
|
@@ -461,7 +465,7 @@ class MultiExecContextTest extends PredisTestCase
|
|
|
$tx->echo('ERR Invalid operation');
|
|
|
$tx->get('foo');
|
|
|
});
|
|
|
- } catch (ServerException $ex) {
|
|
|
+ } catch (ServerException $exception) {
|
|
|
$tx->discard();
|
|
|
}
|
|
|
|
|
@@ -478,16 +482,17 @@ class MultiExecContextTest extends PredisTestCase
|
|
|
*/
|
|
|
public function testIntegrationHandlesStandardExceptionsInBlock()
|
|
|
{
|
|
|
- $client = $this->getClient();
|
|
|
$exception = null;
|
|
|
|
|
|
+ $client = $this->getClient();
|
|
|
+
|
|
|
try {
|
|
|
$client->multiExec(function ($tx) {
|
|
|
$tx->set('foo', 'bar');
|
|
|
throw new \RuntimeException("TEST");
|
|
|
});
|
|
|
- } catch (\Exception $ex) {
|
|
|
- $exception = $ex;
|
|
|
+ } catch (\Exception $exception) {
|
|
|
+ // NOOP
|
|
|
}
|
|
|
|
|
|
$this->assertInstanceOf('RuntimeException', $exception);
|
|
@@ -499,8 +504,9 @@ class MultiExecContextTest extends PredisTestCase
|
|
|
*/
|
|
|
public function testIntegrationThrowsExceptionOnRedisErrorInBlock()
|
|
|
{
|
|
|
- $client = $this->getClient();
|
|
|
$exception = null;
|
|
|
+
|
|
|
+ $client = $this->getClient();
|
|
|
$value = (string) rand();
|
|
|
|
|
|
try {
|
|
@@ -509,8 +515,8 @@ class MultiExecContextTest extends PredisTestCase
|
|
|
$tx->lpush('foo', 'bar');
|
|
|
$tx->set('foo', $value);
|
|
|
});
|
|
|
- } catch (ServerException $ex) {
|
|
|
- $exception = $ex;
|
|
|
+ } catch (ServerException $exception) {
|
|
|
+ // NOOP
|
|
|
}
|
|
|
|
|
|
$this->assertInstanceOf('Predis\ResponseErrorInterface', $exception);
|
|
@@ -559,6 +565,7 @@ class MultiExecContextTest extends PredisTestCase
|
|
|
public function testIntegrationWritesOnWatchedKeysAbortTransaction()
|
|
|
{
|
|
|
$exception = null;
|
|
|
+
|
|
|
$client1 = $this->getClient();
|
|
|
$client2 = $this->getClient();
|
|
|
|
|
@@ -568,8 +575,8 @@ class MultiExecContextTest extends PredisTestCase
|
|
|
$tx->get('sentinel');
|
|
|
$client2->set('sentinel', 'client2');
|
|
|
});
|
|
|
- } catch (AbortedMultiExecException $ex) {
|
|
|
- $exception = $ex;
|
|
|
+ } catch (AbortedMultiExecException $exception) {
|
|
|
+ // NOOP
|
|
|
}
|
|
|
|
|
|
$this->assertInstanceOf('Predis\Transaction\AbortedMultiExecException', $exception);
|