Sensio\Bundle\GeneratorBundle\Tests\Command\GenerateCommandTest::getContainer PHP Метод

getContainer() защищенный Метод

protected getContainer ( )
    protected function getContainer()
    {
        $kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
        $kernel
            ->expects($this->any())
            ->method('getBundle')
            ->will($this->returnValue($this->getBundle()))
        ;

        $filesystem = $this->getMock('Symfony\Component\HttpKernel\Util\Filesystem');
        $filesystem
            ->expects($this->any())
            ->method('isAbsolutePath')
            ->will($this->returnValue(true))
        ;

        $container = new Container();
        $container->set('kernel', $kernel);
        $container->set('filesystem', $filesystem);

        $container->setParameter('kernel.root_dir', sys_get_temp_dir());

        return $container;
    }

Usage Example

 protected function getContainer()
 {
     $container = parent::getContainer();
     $registry = $this->getMock('Symfony\\Bridge\\Doctrine\\RegistryInterface');
     $registry->expects($this->any())->method('getAliasNamespace')->will($this->returnValue('Foo\\FooBundle\\Entity'));
     $container->set('doctrine', $registry);
     return $container;
 }
All Usage Examples Of Sensio\Bundle\GeneratorBundle\Tests\Command\GenerateCommandTest::getContainer