Skip to content

Commit

Permalink
Fix: Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Dec 10, 2022
1 parent 49e5f5c commit 0d765d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions test/Unit/SchemaNormalizerTest.php
Expand Up @@ -213,7 +213,7 @@ public function testNormalizeThrowsOriginalInvalidAccordingToSchemaExceptionWhen
*/
public function testNormalizeNormalizes(Test\Util\SchemaNormalizer\Scenario $scenario): void
{
$json = Json::fromString($scenario->json());
$json = Json::fromString($scenario->original());

$normalizer = new SchemaNormalizer(
$scenario->schemaUri(),
Expand Down Expand Up @@ -246,23 +246,23 @@ public function provideScenario(): \Generator

$normalizedFile = $fileInfo->getRealPath();

$jsonFile = \preg_replace(
$originalFile = \preg_replace(
'/normalized\.json$/',
'original.json',
$normalizedFile,
);

if (!\is_string($jsonFile)) {
if (!\is_string($originalFile)) {
throw new \RuntimeException(\sprintf(
'Unable to deduce JSON file name from normalized file name "%s".',
'Unable to deduce original JSON file name from normalized JSON file name "%s".',
$normalizedFile,
));
}

if (!\file_exists($jsonFile)) {
if (!\file_exists($originalFile)) {
throw new \RuntimeException(\sprintf(
'Expected "%s" to exist, but it does not.',
$jsonFile,
$originalFile,
));
}

Expand All @@ -274,7 +274,7 @@ public function provideScenario(): \Generator

if (!\is_string($schemaFile)) {
throw new \RuntimeException(\sprintf(
'Unable to deduce file name from normalized file name "%s".',
'Unable to deduce schema JSON file name from normalized JSON file name "%s".',
$normalizedFile,
));
}
Expand All @@ -287,7 +287,7 @@ public function provideScenario(): \Generator
}

$normalized = self::jsonFromFile($normalizedFile);
$json = self::jsonFromFile($jsonFile);
$original = self::jsonFromFile($originalFile);
$schemaUri = \sprintf(
'file://%s',
$schemaFile,
Expand All @@ -301,7 +301,7 @@ public function provideScenario(): \Generator
yield $key => [
Test\Util\SchemaNormalizer\Scenario::create(
$normalized,
$json,
$original,
$schemaUri,
),
];
Expand Down
10 changes: 5 additions & 5 deletions test/Util/SchemaNormalizer/Scenario.php
Expand Up @@ -22,19 +22,19 @@ final class Scenario
{
private function __construct(
private string $normalized,
private string $json,
private string $original,
private string $schemaUri,
) {
}

public static function create(
string $normalized,
string $json,
string $original,
string $schemaUri,
): self {
return new self(
$normalized,
$json,
$original,
$schemaUri,
);
}
Expand All @@ -44,9 +44,9 @@ public function normalized(): string
return $this->normalized;
}

public function json(): string
public function original(): string
{
return $this->json;
return $this->original;
}

public function schemaUri(): string
Expand Down

0 comments on commit 0d765d1

Please sign in to comment.