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'));
    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'))
    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'));
    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'))
    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'))
    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'));