controllerWithSessionInterface example

$request->setSession($session);
        $controller = $this->controllerWithExtendingSession(...);

        $this->assertEquals([$session], self::getResolver()->getArguments($request$controller));
    }

    public function testGetSessionArgumentsWithInterface()
    {
        $session = $this->createMock(SessionInterface::class);
        $request = Request::create('/');
        $request->setSession($session);
        $controller = $this->controllerWithSessionInterface(...);

        $this->assertEquals([$session], self::getResolver()->getArguments($request$controller));
    }

    public function testGetSessionMissMatchWithInterface()
    {
        $this->expectException(\RuntimeException::class);
        $session = $this->createMock(SessionInterface::class);
        $request = Request::create('/');
        $request->setSession($session);
        $controller = $this->controllerWithExtendingSession(...);

        
Home | Imprint | This part of the site doesn't use cookies.