public function testThatOptionsArePasstToClients() { $expectedOptions = ['testKey' => 'testValue', 'anotherTestKey' => 'anotherTestValue']; $clientFactory = new PredisClientCreator($expectedOptions); $redisClient = $clientFactory->createClient(Client::TYPE_REDIS); $actualOptions = ['testKey' => $redisClient->getOptions()->testKey, 'anotherTestKey' => $redisClient->getOptions()->anotherTestKey]; $this->assertEquals($expectedOptions, $actualOptions); $sentinelClient = $clientFactory->createClient(Client::TYPE_SENTINEL); $actualOptions = ['testKey' => $sentinelClient->getOptions()->testKey, 'anotherTestKey' => $sentinelClient->getOptions()->anotherTestKey]; $this->assertEquals($expectedOptions, $actualOptions); }
public function testThatAnExceptionIsThrownForInvalidClientTypes() { $this->setExpectedException('\\PSRedis\\Exception\\ConfigurationError', 'To create a client, you need to provide a valid client type'); $clientFactory = new PredisClientCreator(); $clientFactory->createClient('boe'); }