Ejemplo n.º 1
0
    def testProcess(self):

        container = ContainerBuilder();
        container.register('foo').setPublic(False);
        container.register('bar').setPublic(False);
        container.register('moo').setArguments([Reference('bar')]);

        self._process(container);

        self.assertFalse(container.hasDefinition('foo'));
        self.assertTrue(container.hasDefinition('bar'));
        self.assertTrue(container.hasDefinition('moo'));
Ejemplo n.º 2
0
    def testProcess(self):

        container = ContainerBuilder()
        container.register('foo').setPublic(False)
        container.register('bar').setPublic(False)
        container.register('moo').setArguments([Reference('bar')])

        self._process(container)

        self.assertFalse(container.hasDefinition('foo'))
        self.assertTrue(container.hasDefinition('bar'))
        self.assertTrue(container.hasDefinition('moo'))
Ejemplo n.º 3
0
    def testProcessRemovesUnusedDefinitionsRecursively(self):

        container = ContainerBuilder();
        container.register('foo').setPublic(False);
        container.register('bar').setArguments([Reference('foo')])\
            .setPublic(False);

        self._process(container);

        self.assertFalse(container.hasDefinition('foo'));
        self.assertFalse(container.hasDefinition('bar'));
Ejemplo n.º 4
0
    def testProcessRemovesUnusedDefinitionsRecursively(self):

        container = ContainerBuilder()
        container.register('foo').setPublic(False)
        container.register('bar').setArguments([Reference('foo')])\
            .setPublic(False)

        self._process(container)

        self.assertFalse(container.hasDefinition('foo'))
        self.assertFalse(container.hasDefinition('bar'))
Ejemplo n.º 5
0
    def testProcessWorksWithInlinedDefinitions(self):

        container = ContainerBuilder()
        container\
            .register('foo')\
            .setPublic(False)\

        container\
            .register('bar')\
            .setArguments([Definition(None, [Reference('foo')])])\

        self._process(container)

        self.assertTrue(container.hasDefinition('foo'))
        self.assertTrue(container.hasDefinition('bar'))
Ejemplo n.º 6
0
    def testProcessWorksWithInlinedDefinitions(self):

        container = ContainerBuilder();
        container\
            .register('foo')\
            .setPublic(False)\
        ;
        container\
            .register('bar')\
            .setArguments([Definition(None, [Reference('foo')])])\
        ;

        self._process(container);

        self.assertTrue(container.hasDefinition('foo'));
        self.assertTrue(container.hasDefinition('bar'));