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
)],
'Argument has no type' =>
[false,
new Request([],
[],
['foo' =>
(string) $uuidV4]),
new ArgumentMetadata('foo', null, false, false, null
)],
'Argument type is not a class' =>
[false,
new Request([],
[],
['foo' =>
(string) $uuidV4]),
new ArgumentMetadata('foo', 'string', false, false, null
)],
'Argument type is not a subclass of AbstractUid' =>
[false,
new Request([],
[],
['foo' =>
(string) $uuidV4]),
new ArgumentMetadata('foo', UlidFactory::
class, false, false, null
)],
'AbstractUid is not supported' =>
[false,
new Request([],
[],
['foo' =>
(string) $uuidV4]),
new ArgumentMetadata('foo', AbstractUid::
class, false, false, null
)],
'Custom abstract subclass is supported but will fail in resolve' =>
[true,
new Request([],
[],
['foo' =>
(string) $uuidV4]),
new ArgumentMetadata('foo', TestAbstractCustomUid::
class, false, false, null
)],
'Known subclass' =>
[true,
new Request([],
[],
['foo' =>
(string) $uuidV4]),
new ArgumentMetadata('foo', UuidV4::
class, false, false, null
)],
'Format does not matter' =>
[true,
new Request([],
[],
['foo' =>
(string) $uuidV4]),
new ArgumentMetadata('foo', Ulid::
class, false, false, null
)],
'Custom subclass' =>
[true,
new Request([],
[],
['foo' => '01FPND7BD15ZV07X5VGDXAJ8VD'
]),
new ArgumentMetadata('foo', TestCustomUid::
class, false, false, null
)],
];
}