/** * @param string $serverAlias * * @return ServerInterface */ private function guessServer($serverAlias) { if (self::USE_DEFAULT_KEY == $serverAlias) { return $this->serverRegistry->getDefault(); } elseif ($this->container->has($serverAlias)) { return $this->container->get($serverAlias); } else { return $this->serverRegistry->get($serverAlias); } }
/** * @expectedException \RuntimeException * @expectedExceptionCode 3 */ public function testGetDefaultAndTooMany() { $serv1 = $this->getMock(ServerInterface::class); $serv2 = $this->getMock(ServerInterface::class); $reg = new ServerRegistry(); $reg->add('foo', $serv1, false); $reg->add('bar', $serv2, false); $reg->getDefault(); }