mirror of
https://github.com/predis/predis.git
synced 2026-09-13 20:07:28 +00:00
[tests] No need to reassign $exception.
This commit is contained in:
@@ -332,6 +332,8 @@ class PipelineTest extends PredisTestCase
|
|||||||
*/
|
*/
|
||||||
public function testExecuteWithCallableArgumentHandlesExceptions()
|
public function testExecuteWithCallableArgumentHandlesExceptions()
|
||||||
{
|
{
|
||||||
|
$exception = null;
|
||||||
|
|
||||||
$connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
|
$connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
|
||||||
$connection->expects($this->never())->method('writeRequest');
|
$connection->expects($this->never())->method('writeRequest');
|
||||||
$connection->expects($this->never())->method('readResponse');
|
$connection->expects($this->never())->method('readResponse');
|
||||||
@@ -347,8 +349,8 @@ class PipelineTest extends PredisTestCase
|
|||||||
throw new ClientException('TEST');
|
throw new ClientException('TEST');
|
||||||
$pipe->echo('two');
|
$pipe->echo('two');
|
||||||
});
|
});
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $exception) {
|
||||||
$exception = $ex;
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertInstanceOf('Predis\ClientException', $exception);
|
$this->assertInstanceOf('Predis\ClientException', $exception);
|
||||||
@@ -415,6 +417,8 @@ class PipelineTest extends PredisTestCase
|
|||||||
*/
|
*/
|
||||||
public function testIntegrationWithClientExceptionInCallableBlock()
|
public function testIntegrationWithClientExceptionInCallableBlock()
|
||||||
{
|
{
|
||||||
|
$exception = null;
|
||||||
|
|
||||||
$client = $this->getClient();
|
$client = $this->getClient();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -422,8 +426,8 @@ class PipelineTest extends PredisTestCase
|
|||||||
$pipe->set('foo', 'bar');
|
$pipe->set('foo', 'bar');
|
||||||
throw new ClientException('TEST');
|
throw new ClientException('TEST');
|
||||||
});
|
});
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $exception) {
|
||||||
$exception = $ex;
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertInstanceOf('Predis\ClientException', $exception);
|
$this->assertInstanceOf('Predis\ClientException', $exception);
|
||||||
@@ -436,6 +440,8 @@ class PipelineTest extends PredisTestCase
|
|||||||
*/
|
*/
|
||||||
public function testIntegrationWithServerExceptionInCallableBlock()
|
public function testIntegrationWithServerExceptionInCallableBlock()
|
||||||
{
|
{
|
||||||
|
$exception = null;
|
||||||
|
|
||||||
$client = $this->getClient();
|
$client = $this->getClient();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -446,8 +452,8 @@ class PipelineTest extends PredisTestCase
|
|||||||
$pipe->lpush('foo', 'bar');
|
$pipe->lpush('foo', 'bar');
|
||||||
$pipe->set('hoge', 'piyo');
|
$pipe->set('hoge', 'piyo');
|
||||||
});
|
});
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $exception) {
|
||||||
$exception = $ex;
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertInstanceOf('Predis\Response\ServerException', $exception);
|
$this->assertInstanceOf('Predis\Response\ServerException', $exception);
|
||||||
|
|||||||
Reference in New Issue
Block a user