Skip to content

Commit

Permalink
Enhancement: Assert that ConfigHashNormalizer continues to normalize …
Browse files Browse the repository at this point in the history
…when property is empty
  • Loading branch information
localheinz committed Dec 29, 2020
1 parent 6b5d8c6 commit efd32ca
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/Unit/Vendor/Composer/ConfigHashNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,39 @@ public function testNormalizeIgnoresEmptyConfigHash(string $property): void
self::assertJsonStringEqualsJsonStringNormalized($json->encoded(), $normalized->encoded());
}

public function testNormalizeIgnoresEmptyConfigHashButContinuesNormalizing(): void
{
$json = Json::fromEncoded(
<<<'JSON'
{
"config": {},
"extra": {
"foo": "bar",
"bar": "baz"
}
}
JSON
);

$expected = Json::fromEncoded(
<<<'JSON'
{
"config": {},
"extra": {
"bar": "baz",
"foo": "bar"
}
}
JSON
);

$normalizer = new ConfigHashNormalizer();

$normalized = $normalizer->normalize($json);

self::assertJsonStringEqualsJsonStringNormalized($expected->encoded(), $normalized->encoded());
}

/**
* @dataProvider provideProperty
*/
Expand Down

0 comments on commit efd32ca

Please sign in to comment.