RequestFacadeFactory example


class RequestFacadeFactoryTest extends TestCase
{
    public function testFactory(): void
    {
        $request = new Request();
        $request->server->set('REQUEST_URI', '/foo/bar');
        $request->attributes->set('sw-original-request-uri', 'https://example.com/foo/bar');
        $stack = new RequestStack();
        $stack->push($request);

        $factory = new RequestFacadeFactory($stack);

        static::assertSame('request', $factory->getName());

        $script = new Script('foo', 'bar', new \DateTimeImmutable());

        $facade = $factory->factory($this->createMock(Hook::class)$script);

        static::assertSame('https://example.com/foo/bar', $facade->uri());
    }
}
Home | Imprint | This part of the site doesn't use cookies.