def testProcessIgnoresCrossScopeHierarchyReferenceIfNotStrict(self): container = ContainerBuilder(); container.addScope(Scope('a')); container.addScope(Scope('b')); container.register('a').setScope('a').addArgument(Reference('b', ContainerInterface.EXCEPTION_ON_INVALID_REFERENCE, False)); container.register('b').setScope('b'); self._process(container);
def testProcessIgnoresCrossScopeHierarchyReferenceIfNotStrict(self): container = ContainerBuilder() container.addScope(Scope('a')) container.addScope(Scope('b')) container.register('a').setScope('a').addArgument( Reference('b', ContainerInterface.EXCEPTION_ON_INVALID_REFERENCE, False)) container.register('b').setScope('b') self._process(container)
def testProcessDetectsCrossScopeHierarchyReference(self): """@expectedException RuntimeException """ try: container = ContainerBuilder(); container.addScope(Scope('a')); container.addScope(Scope('b')); container.register('a').setScope('a').addArgument(Reference('b')); container.register('b').setScope('b'); self._process(container); self.fail() except Exception as e: self.assertTrue(isinstance(e, RuntimeException));
def testProcessDetectsCrossScopeHierarchyReference(self): """@expectedException RuntimeException """ try: container = ContainerBuilder() container.addScope(Scope('a')) container.addScope(Scope('b')) container.register('a').setScope('a').addArgument(Reference('b')) container.register('b').setScope('b') self._process(container) self.fail() except Exception as e: self.assertTrue(isinstance(e, RuntimeException))