Skip to content

Commit f7dc2b9

Browse files
authored
Merge pull request #22 from shouze/fixup-previously-merged-pr-19
Fixup some forgot pieces of #19
2 parents da2600d + 6cd8b87 commit f7dc2b9

File tree

4 files changed

+12
-26
lines changed

4 files changed

+12
-26
lines changed

.atoum.php

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
[fr] http://docs.atoum.org/fr/latest/lancement_des_tests.html#fichier-de-configuration
1111
*/
1212

13-
use \mageekguy\atoum;
14-
1513
$report = $script->addDefaultReport();
1614

1715
// This will add a green or red logo after each run depending on its status.

.bootstrap.atoum.php

-12
This file was deleted.

src/PayloadValidator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ public function validate($payload, $jsonSchemaFilename)
1818
}
1919

2020
$delegateValidator = $this->jsonSchemaTools->createValidator();
21-
$refResolver = $this->jsonSchemaTools->createSchemaStorage();
21+
$schemaStorage = $this->jsonSchemaTools->createSchemaStorage();
2222

2323
$data = json_decode($payload);
2424
$delegateValidator->check(
2525
$data,
26-
$refResolver->resolveRef('file://' . realpath($jsonSchemaFilename))
26+
$schemaStorage->resolveRef('file://' . realpath($jsonSchemaFilename))
2727
);
2828

2929
if (!$delegateValidator->isValid()) {

tests/Units/PayloadValidator.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ public function test_validation_should_be_delegated_to_internal_validator()
1212
->given(
1313
$validator = $this->mockJsonSchemaValidator(),
1414
$this->calling($validator)->check = null,
15-
$refResolver = $this->mockJsonSchemaRefResolver(),
16-
$this->calling($refResolver)->resolveRef = 'resolvedJsonSchema',
17-
$jsonSchemaTools = $this->mockJsonSchemaTools($validator, $refResolver),
15+
$schemaStorage = $this->mockJsonSchemaStorage(),
16+
$this->calling($schemaStorage)->resolveRef = 'resolvedJsonSchema',
17+
$jsonSchemaTools = $this->mockJsonSchemaTools($validator, $schemaStorage),
1818
$this->newTestedInstance($jsonSchemaTools)
1919
)
2020
->when(
@@ -50,9 +50,9 @@ public function test_invalid_internal_validation_lead_to_exception()
5050
$this->calling($validator)->check = null,
5151
$this->calling($validator)->isValid = false,
5252
$this->calling($validator)->getErrors = ['error1', 'error2'],
53-
$refResolver = $this->mockJsonSchemaRefResolver(),
54-
$this->calling($refResolver)->resolve = 'resolvedJsonSchema',
55-
$jsonSchemaTools = $this->mockJsonSchemaTools($validator, $refResolver),
53+
$schemaStorage = $this->mockJsonSchemaStorage(),
54+
$this->calling($schemaStorage)->resolveRef = 'resolvedJsonSchema',
55+
$jsonSchemaTools = $this->mockJsonSchemaTools($validator, $schemaStorage),
5656
$this->newTestedInstance($jsonSchemaTools)
5757
)
5858
->exception(function () {
@@ -71,19 +71,19 @@ private function mockJsonSchemaValidator()
7171
return new \mock\JsonSchema\Validator;
7272
}
7373

74-
private function mockJsonSchemaRefResolver()
74+
private function mockJsonSchemaStorage()
7575
{
7676
$this->mockGenerator->orphanize('__construct');
7777

78-
return new \mock\JsonSchema\JsonStorage();
78+
return new \mock\JsonSchema\SchemaStorage();
7979
}
8080

81-
private function mockJsonSchemaTools($validator = null, $refResolver = null)
81+
private function mockJsonSchemaTools($validator = null, $schemaStorage = null)
8282
{
8383
$this->mockGenerator->orphanize('__construct');
8484
$mock = new \mock\Rezzza\SymfonyRestApiJson\JsonSchemaTools;
8585
$this->calling($mock)->createValidator = $validator;
86-
$this->calling($mock)->createSchemaStorage = $refResolver;
86+
$this->calling($mock)->createSchemaStorage = $schemaStorage;
8787

8888
return $mock;
8989
}

0 commit comments

Comments
 (0)