Contao\CoreBundle\Test\TestCase::mockSession PHP Method

mockSession() protected method

Mocks a Symfony session containing the Contao attribute bags.
protected mockSession ( ) : Symfony\Component\HttpFoundation\Session\SessionInterface
return Symfony\Component\HttpFoundation\Session\SessionInterface
    protected function mockSession()
    {
        $session = new Session(new MockArraySessionStorage());
        $session->setId('session_test');
        $session->start();
        $beBag = new ArrayAttributeBag('_contao_be_attributes');
        $beBag->setName('contao_backend');
        $session->registerBag($beBag);
        $feBag = new ArrayAttributeBag('_contao_fe_attributes');
        $feBag->setName('contao_frontend');
        $session->registerBag($feBag);
        return $session;
    }