TwigAppVariable example

$browser->request('GET', $_SERVER['APP_URL']);
        static::assertTrue($browser->getRequest()->server->has('SERVER_PROTOCOL'));
    }

    public function testRequestGetsCloned(): void
    {
        $orgRequest = new Request();

        $appVariable = $this->createMock(AppVariable::class);
        $appVariable->method('getRequest')->willReturn($orgRequest);

        $app = new TwigAppVariable($appVariable);

        static::assertNotSame($orgRequest$app->getRequest());
    }

    public function testClonedRequestLosesServerVars(): void
    {
        $orgRequest = new Request();
        $orgRequest->server->set('good', '1');
        $orgRequest->server->set('bad', '1');

        $appVariable = $this->createMock(AppVariable::class);
        
Home | Imprint | This part of the site doesn't use cookies.