-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from fhjbalfoort/master
RedisStore use ClientInterface instead of Client
- Loading branch information
Showing
4 changed files
with
108 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
tests/Ackintosh/Ganesha/Storage/Adapter/PredisRedisClientInterfaceTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Ackintosh\Ganesha\Storage\Adapter; | ||
|
||
use Predis\ClientInterface; | ||
|
||
class PredisRedisClientInterfaceTest extends PredisRedisTest | ||
{ | ||
protected function getRedisConnection(): ClientInterface | ||
{ | ||
return new PredisRedisClientInterfaceTestDouble( | ||
parent::getRedisConnection() | ||
); | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
tests/Ackintosh/Ganesha/Storage/Adapter/PredisRedisClientInterfaceTestDouble.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Ackintosh\Ganesha\Storage\Adapter; | ||
|
||
use Predis\ClientInterface; | ||
use Predis\Command\CommandInterface; | ||
|
||
final class PredisRedisClientInterfaceTestDouble implements ClientInterface | ||
{ | ||
/** | ||
* @var ClientInterface | ||
*/ | ||
private $client; | ||
|
||
public function __construct(ClientInterface $client) | ||
{ | ||
$this->client = $client; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getProfile() | ||
{ | ||
return $this->client->getProfile(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getOptions() | ||
{ | ||
return $this->client->getOptions(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function connect() | ||
{ | ||
$this->client->connect(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function disconnect() | ||
{ | ||
$this->client->disconnect(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getConnection() | ||
{ | ||
return $this->client->getConnection(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function createCommand($commandID, $arguments = []) | ||
{ | ||
return $this->client->createCommand($commandID, $arguments); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function executeCommand(CommandInterface $command) | ||
{ | ||
return $this->client->executeCommand($command); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function __call($commandID, $arguments) | ||
{ | ||
return $this->executeCommand( | ||
$this->createCommand($commandID, $arguments) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters