/** * @covers PPI\Framework\ServiceManager::resolveAlias */ public function testSetCircularAliasReferenceThrowsException() { $this->setExpectedException('Zend\\ServiceManager\\Exception\\CircularReferenceException'); // Only affects service managers that allow overwriting definitions $this->serviceManager->setAllowOverride(true); $this->serviceManager->setInvokableClass('foo-service', 'stdClass'); $this->serviceManager->setAlias('foo-alias', 'foo-service'); $this->serviceManager->setAlias('bar-alias', 'foo-alias'); $this->serviceManager->setAlias('baz-alias', 'bar-alias'); // This will now cause a cyclic reference and should throw an exception $this->serviceManager->setAlias('foo-alias', 'bar-alias'); }