コード例 #1
0
 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);
 }
コード例 #2
0
 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');
 }