/** * @param $scope * @return IVariableRegistry * @throws InvalidScopeException */ private function getVariableRegistry($scope) { if (!array_key_exists($scope, $this->variableRegistries)) { throw new InvalidScopeException(InvalidScopeException::formatMessage($scope)); } return $this->variableRegistries[$scope]; }
public function testInvalidScopeException() { try { $this->binder->restore(new ClassToBind(), 'public'); $this->fail('A exception of type [Nucleus\\Binder\\InvalidScopeException] should have be thrown'); } catch (InvalidScopeException $e) { $this->assertEquals(InvalidScopeException::formatMessage(IBinder::DEFAULT_SCOPE), $e->getMessage()); } }