Skip to content

Commit

Permalink
BUGFIX: Add test to prove that optional parameters are passed into un…
Browse files Browse the repository at this point in the history
…expected slots when parameters in between are missing
  • Loading branch information
mficzel committed Jun 19, 2024
1 parent cafa8fb commit 37761e9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Tests/Unit/Domain/Schema/SchemaNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,30 @@

final class SchemaNormalizerTest extends TestCase
{
public static function denormalizeObjectsWithOptionalParametersDataProvider(): \Generator
{
yield 'min PostalAddress' => [
Fixtures\PostalAddress::class,
['streetAddress' => 'Sesamstraße 42', 'addressRegion' => 'Muppetingen'],
new Fixtures\PostalAddress(streetAddress: 'Sesamstraße 42', addressRegion: 'Muppetingen')
];
yield 'PostalAddress with missing parameter in between' => [
Fixtures\PostalAddress::class,
['streetAddress' => 'Dämonenweg 23', 'addressRegion' => 'Hölle', 'postOfficeBoxNumber' => 666],
new Fixtures\PostalAddress(streetAddress: 'Dämonenweg 23', addressRegion: 'Hölle', postOfficeBoxNumber: '666')
];
}

/**
* @dataProvider denormalizeObjectsWithOptionalParametersDataProvider
* @test
*/
public function denormalizeObjectsWithOptionalParameters(mixed $type, mixed $data, mixed $expected): void
{
Assert::assertEquals($expected, SchemaDenormalizer::denormalizeValue($data, $type));
}


/**
* @dataProvider valueNormalizationPairs
* @test
Expand Down

0 comments on commit 37761e9

Please sign in to comment.