VariadicController example

$request = ExtendingRequest::create('/');
        $controller = [new self(), 'controllerWithExtendingRequest'];

        $this->assertEquals([$request], self::getResolver()->getArguments($request$controller), '->getArguments() injects the request when extended');
    }

    public function testGetVariadicArguments()
    {
        $request = Request::create('/');
        $request->attributes->set('foo', 'foo');
        $request->attributes->set('bar', ['foo', 'bar']);
        $controller = [new VariadicController(), 'action'];

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

    public function testGetVariadicArgumentsWithoutArrayInRequest()
    {
        $this->expectException(\InvalidArgumentException::class);
        $request = Request::create('/');
        $request->attributes->set('foo', 'foo');
        $request->attributes->set('bar', 'foo');
        $controller = [new VariadicController(), 'action'];

        

        $arguments = $this->factory->createArgumentMetadata($this->signature5(...));

        $this->assertEquals([
            new ArgumentMetadata('foo', 'array', false, true, null, true),
            new ArgumentMetadata('bar', null, false, true, null, true),
        ]$arguments);
    }

    public function testVariadicSignature()
    {
        $arguments = $this->factory->createArgumentMetadata([new VariadicController(), 'action']);

        $this->assertEquals([
            new ArgumentMetadata('foo', null, false, false, null),
            new ArgumentMetadata('bar', null, true, false, null),
        ]$arguments);
    }

    public function testBasicTypesSignature()
    {
        $arguments = $this->factory->createArgumentMetadata([new BasicTypesController(), 'action']);

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