[tests] Share common test among connection classes.

This commit is contained in:
Daniele Alessandri
2015-07-25 18:41:55 +02:00
parent cb09a7a2b5
commit 1c8eb7ff6b
6 changed files with 55 additions and 177 deletions
@@ -16,6 +16,8 @@ namespace Predis\Connection;
*/
class StreamConnectionTest extends PredisConnectionTestCase
{
const CONNECTION_CLASS = 'Predis\Connection\StreamConnection';
/**
* @group disconnected
*/
@@ -212,31 +214,4 @@ class StreamConnectionTest extends PredisConnectionTestCase
$connection->read();
}
// ******************************************************************** //
// ---- HELPER METHODS ------------------------------------------------ //
// ******************************************************************** //
/**
* {@inheritdoc}
*/
protected function getConnection(&$profile = null, $initialize = false, array $parameters = array())
{
$parameters = $this->getParameters($parameters);
$profile = $this->getProfile();
$connection = new StreamConnection($parameters);
if ($initialize) {
$connection->addConnectCommand(
$profile->createCommand('select', array($parameters->database))
);
$connection->addConnectCommand(
$profile->createCommand('flushdb')
);
}
return $connection;
}
}