controllerWithFooAndDefaultBar example


        $this->expectException(\InvalidArgumentException::class);
        $valueResolver = $this->createMock(ArgumentValueResolverInterface::class);
        $resolver = self::getResolver([$valueResolver]);

        $valueResolver->expects($this->any())->method('supports')->willReturn(true);
        $valueResolver->expects($this->any())->method('resolve')->willReturn([]);

        $request = Request::create('/');
        $request->attributes->set('foo', 'foo');
        $request->attributes->set('bar', 'foo');
        $controller = $this->controllerWithFooAndDefaultBar(...);
        $resolver->getArguments($request$controller);
    }

    public function testIfExceptionIsThrownWhenMissingAnArgument()
    {
        $this->expectException(\RuntimeException::class);
        $request = Request::create('/');
        $controller = $this->controllerWithFoo(...);

        self::getResolver()->getArguments($request$controller);
    }

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