Snc\RedisBundle\Tests\CommandTestCase::setUp PHP Метод

setUp() публичный Метод

SetUp called before each tests, setting up the environment (application, globally used mocks)
public setUp ( )
    public function setUp()
    {
        $this->container = $this->getMock('\\Symfony\\Component\\DependencyInjection\\ContainerInterface');
        $kernel = $this->getMockBuilder('\\Symfony\\Component\\HttpKernel\\Kernel')->disableOriginalConstructor()->getMock();
        $kernel->expects($this->once())->method('getBundles')->will($this->returnValue(array()));
        $kernel->expects($this->once())->method('getContainer')->will($this->returnValue($this->container));
        $this->application = new Application($kernel);
        $this->predisClient = $this->getMock('\\Predis\\Client');
        $this->phpredisClient = $this->getMockBuilder('PhpredisClient')->disableOriginalConstructor()->getMock();
        $command = $this->getCommand();
        $this->application->add($command);
        $command->setContainer($this->container);
    }

Usage Example

 public function setUp()
 {
     parent::setUp();
     $this->registerPredisClient();
 }