You are here

public function Redis_Tests_Client_UnitTestCase::testManagerServerList in Redis 7.3

File

lib/Redis/Tests/Client/ClientUnitTestCase.test, line 36

Class

Redis_Tests_Client_UnitTestCase

Code

public function testManagerServerList() {
  $manager = $this
    ->getManager();
  $defaultClient = $manager
    ->getClient();
  $this
    ->assertTrue(is_object($defaultClient));

  // Ensure defaults are OK
  $this
    ->assertIdentical(Redis_Client_Manager::REDIS_DEFAULT_HOST, $defaultClient->host);
  $this
    ->assertIdentical(Redis_Client_Manager::REDIS_DEFAULT_PORT, $defaultClient->port);
  $this
    ->assertFalse(property_exists($defaultClient, 'base'));
  $this
    ->assertFalse(property_exists($defaultClient, 'password'));
  $client = $manager
    ->getClient('foo');
  $this
    ->assertIdentical('foo.com', $client->host);
  $this
    ->assertIdentical(666, $client->port);
  $client = $manager
    ->getClient('bar');
  $this
    ->assertIdentical('bar.com', $client->host);
  $this
    ->assertIdentical(Redis_Client_Manager::REDIS_DEFAULT_PORT, $client->port);
  $this
    ->assertIdentical($defaultClient, $manager
    ->getClient('non_existing'));
  try {
    $manager
      ->getClient('other_non_existing', false);
    $this
      ->assert(false);
  } catch (\InvalidArgumentException $e) {
    $this
      ->assert(true);
  }
}