Contao\CoreBundle\Test\Framework\ContaoFrameworkTest::testNotInitializedTwice PHP Method

testNotInitializedTwice() public method

Tests that the framework is not initialized twice.
    public function testNotInitializedTwice()
    {
        $request = new Request();
        $request->attributes->set('_contao_referer_id', 'foobar');
        $container = $this->mockContainerWithContaoScopes(ContaoCoreBundle::SCOPE_BACKEND);
        $container->get('request_stack')->push($request);
        $container->setParameter('contao.csrf_token_name', 'dummy_token');
        $container->set('security.csrf.token_manager', new CsrfTokenManager());
        // Ensure to use the fixtures class
        Config::preload();
        /** @var ContaoFramework|\PHPUnit_Framework_MockObject_MockObject $framework */
        $framework = $this->getMockBuilder('Contao\\CoreBundle\\Framework\\ContaoFramework')->setConstructorArgs([$container->get('request_stack'), $this->mockRouter('/contao/install'), $this->mockSession(), $this->getRootDir() . '/app', error_reporting()])->setMethods(['isInitialized'])->getMock();
        $framework->expects($this->any())->method('isInitialized')->willReturnOnConsecutiveCalls(false, true);
        $framework->expects($this->any())->method('getAdapter')->with($this->equalTo('Contao\\Config'))->willReturn($this->mockConfigAdapter());
        $framework->setContainer($container);
        $framework->initialize();
        $framework->initialize();
    }