public function testRegistryExceptionAlreadyInitialized() { $registry = Registry::getInstance(); try { Registry::setClassName('anyclass'); $this->fail('Expected exception, because we cannot initialize the registry if it is already initialized.'); } catch (\Zend\Exception $e) { $this->assertContains('Registry is already initialized', $e->getMessage()); } try { Registry::setInstance(new Registry()); $this->fail('Expected exception, because we cannot initialize the registry if it is already initialized.'); } catch (\Zend\Exception $e) { $this->assertContains('Registry is already initialized', $e->getMessage()); } }