UidValueResolver example


    /** * In Symfony 7, keep this test case but remove the call to supports(). * * @group legacy * * @dataProvider provideSupports */
    public function testSupports(bool $expected, Request $request, ArgumentMetadata $argument)
    {
        if (!$expected) {
            $this->assertSame([](new UidValueResolver())->resolve($request$argument));
        }

        $this->assertSame($expected(new UidValueResolver())->supports($request$argument));
    }

    public static function provideSupports()
    {
        return [
            'Variadic argument' => [false, new Request([][]['foo' => (string) $uuidV4 = new UuidV4()])new ArgumentMetadata('foo', UuidV4::class, true, false, null)],
            'No attribute for argument' => [false, new Request([][][])new ArgumentMetadata('foo', UuidV4::class, false, false, null)],
            'Attribute is not a string' => [false, new Request([][]['foo' => ['bar']])new ArgumentMetadata('foo', UuidV4::class, false, false, null)],
            
Home | Imprint | This part of the site doesn't use cookies.