/** * @expectedException \OutOfBoundsException */ public function testNoServers() { $environment = new CloudEnvironment(); $environment->setEnvironment(Environment::PRODUCTION)->setCredentialsFilepath(__DIR__ . '/json/no-servers.json'); $service = new MemcacheService(); $service->setCloudEnvironment($environment); $service->credentials(); }
public function testAddMemcacheCredentials() { $env = new LocalEnvironment(self::SITEGROUP); $return = $env->addMemcacheCredentials('localhost', 12345); $this->assertEquals($env, $return); $memcache = new MemcacheService($env); $creds = $memcache->credentials(); $this->assertTrue(is_array($creds)); $this->assertEquals(1, count($creds)); foreach ($creds as $server) { $this->assertInstanceOf('\\Acquia\\Cloud\\Memcache\\MemcacheCredentials', $server); $this->assertEquals('localhost', $server->host()); $this->assertEquals('12345', $server->port()); $this->assertEquals('localhost:12345', (string) $server); } }