Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vdauchy authored and dkarlovi committed Jul 1, 2024
1 parent ea60083 commit 59d769d
Show file tree
Hide file tree
Showing 54 changed files with 268 additions and 268 deletions.
8 changes: 4 additions & 4 deletions JsonSchema/Normalizer/JaneObjectNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class JaneObjectNormalizer implements DenormalizerInterface, NormalizerInterface
use CheckArray;
use ValidatorTrait;
protected $normalizers = array(

'Jane\\Component\\JsonSchema\\JsonSchema\\Model\\JsonSchema' => 'Jane\\Component\\JsonSchema\\JsonSchema\\Normalizer\\JsonSchemaNormalizer',
'\\Jane\\Component\\JsonSchemaRuntime\\Reference' => '\\Jane\\Component\\JsonSchema\\JsonSchema\\Runtime\\Normalizer\\ReferenceNormalizer',
), $normalizersCache = [];
Expand Down Expand Up @@ -57,7 +57,7 @@ private function initNormalizer(string $normalizerClass)
}
public function getSupportedTypes(?string $format = null) : array
{
return ['Jane\\Component\\JsonSchema\\JsonSchema\\Model\\JsonSchema' => false, '\\Jane\\Component\\JsonSchemaRuntime\\Reference' => false];
return [\Jane\Component\JsonSchema\JsonSchema\Model\JsonSchema::class => false, \Jane\Component\JsonSchemaRuntime\Reference::class => false];
}
}
} else {
Expand All @@ -68,7 +68,7 @@ class JaneObjectNormalizer implements DenormalizerInterface, NormalizerInterface
use CheckArray;
use ValidatorTrait;
protected $normalizers = array(

'Jane\\Component\\JsonSchema\\JsonSchema\\Model\\JsonSchema' => 'Jane\\Component\\JsonSchema\\JsonSchema\\Normalizer\\JsonSchemaNormalizer',
'\\Jane\\Component\\JsonSchemaRuntime\\Reference' => '\\Jane\\Component\\JsonSchema\\JsonSchema\\Runtime\\Normalizer\\ReferenceNormalizer',
), $normalizersCache = [];
Expand Down Expand Up @@ -112,7 +112,7 @@ private function initNormalizer(string $normalizerClass)
}
public function getSupportedTypes(?string $format = null) : array
{
return ['Jane\\Component\\JsonSchema\\JsonSchema\\Model\\JsonSchema' => false, '\\Jane\\Component\\JsonSchemaRuntime\\Reference' => false];
return [\Jane\Component\JsonSchema\JsonSchema\Model\JsonSchema::class => false, \Jane\Component\JsonSchemaRuntime\Reference::class => false];
}
}
}
96 changes: 48 additions & 48 deletions JsonSchema/Normalizer/JsonSchemaNormalizer.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion JsonSchema/Runtime/Normalizer/ReferenceNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function normalize(mixed $object, string $format = null, array $context =
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null, array $context = array()) : bool
public function supportsNormalization($data, $format = null, array $context = []) : bool
{
return $data instanceof Reference;
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Generator/Context/UniqueVariableScopeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ public function testUniqueVariable(): void
$name = $uniqueVariableScope->getUniqueName('name');
$this->assertEquals('name_2', $name);
}
}
}
2 changes: 1 addition & 1 deletion Tests/JaneBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ public function schemaProvider(): array

return $data;
}
}
}
2 changes: 1 addition & 1 deletion Tests/Validation/ValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -946,4 +946,4 @@ private function verifyNullableStringPropertyWithMinLengthValidatesCorrectly():
self::assertInstanceOf(VerifyNullableStringPropertyWithMinLengthValidatesCorrectly::class, $data);
self::assertNull($data->getName());
}
}
}
2 changes: 1 addition & 1 deletion Tests/Validation/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion Tests/data/json-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,4 @@
"default": []
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AdditionalPropertiesNormalizer implements DenormalizerInterface, Normalize
use ValidatorTrait;
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []) : bool
{
return $type === 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\AdditionalProperties';
return $type === \Jane\Component\JsonSchema\Tests\Expected\Model\AdditionalProperties::class;
}
public function supportsNormalization(mixed $data, string $format = null, array $context = []) : bool
{
Expand Down Expand Up @@ -66,7 +66,7 @@ public function normalize(mixed $object, string $format = null, array $context =
}
public function getSupportedTypes(?string $format = null) : array
{
return ['Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\AdditionalProperties' => false];
return [\Jane\Component\JsonSchema\Tests\Expected\Model\AdditionalProperties::class => false];
}
}
} else {
Expand All @@ -78,7 +78,7 @@ class AdditionalPropertiesNormalizer implements DenormalizerInterface, Normalize
use ValidatorTrait;
public function supportsDenormalization($data, $type, string $format = null, array $context = []) : bool
{
return $type === 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\AdditionalProperties';
return $type === \Jane\Component\JsonSchema\Tests\Expected\Model\AdditionalProperties::class;
}
public function supportsNormalization($data, $format = null, array $context = []) : bool
{
Expand Down Expand Up @@ -128,7 +128,7 @@ public function normalize($object, $format = null, array $context = [])
}
public function getSupportedTypes(?string $format = null) : array
{
return ['Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\AdditionalProperties' => false];
return [\Jane\Component\JsonSchema\Tests\Expected\Model\AdditionalProperties::class => false];
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PatternPropertiesNormalizer implements DenormalizerInterface, NormalizerIn
use ValidatorTrait;
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []) : bool
{
return $type === 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\PatternProperties';
return $type === \Jane\Component\JsonSchema\Tests\Expected\Model\PatternProperties::class;
}
public function supportsNormalization(mixed $data, string $format = null, array $context = []) : bool
{
Expand All @@ -49,7 +49,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
$object[$key] = $value;
}
if (preg_match('/xxxx-.*/', (string) $key)) {
$object[$key] = $this->denormalizer->denormalize($value, 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\AdditionalProperties', 'json', $context);
$object[$key] = $this->denormalizer->denormalize($value, \Jane\Component\JsonSchema\Tests\Expected\Model\AdditionalProperties::class, 'json', $context);
}
}
return $object;
Expand All @@ -72,7 +72,7 @@ public function normalize(mixed $object, string $format = null, array $context =
}
public function getSupportedTypes(?string $format = null) : array
{
return ['Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\PatternProperties' => false];
return [\Jane\Component\JsonSchema\Tests\Expected\Model\PatternProperties::class => false];
}
}
} else {
Expand All @@ -84,7 +84,7 @@ class PatternPropertiesNormalizer implements DenormalizerInterface, NormalizerIn
use ValidatorTrait;
public function supportsDenormalization($data, $type, string $format = null, array $context = []) : bool
{
return $type === 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\PatternProperties';
return $type === \Jane\Component\JsonSchema\Tests\Expected\Model\PatternProperties::class;
}
public function supportsNormalization($data, $format = null, array $context = []) : bool
{
Expand Down Expand Up @@ -114,7 +114,7 @@ public function denormalize($data, $type, $format = null, array $context = [])
$object[$key] = $value;
}
if (preg_match('/xxxx-.*/', (string) $key)) {
$object[$key] = $this->denormalizer->denormalize($value, 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\AdditionalProperties', 'json', $context);
$object[$key] = $this->denormalizer->denormalize($value, \Jane\Component\JsonSchema\Tests\Expected\Model\AdditionalProperties::class, 'json', $context);
}
}
return $object;
Expand All @@ -140,7 +140,7 @@ public function normalize($object, $format = null, array $context = [])
}
public function getSupportedTypes(?string $format = null) : array
{
return ['Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\PatternProperties' => false];
return [\Jane\Component\JsonSchema\Tests\Expected\Model\PatternProperties::class => false];
}
}
}
8 changes: 4 additions & 4 deletions Tests/fixtures/all-of/expected/Normalizer/BarNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BarNormalizer implements DenormalizerInterface, NormalizerInterface, Denor
use ValidatorTrait;
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []) : bool
{
return $type === 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\Bar';
return $type === \Jane\Component\JsonSchema\Tests\Expected\Model\Bar::class;
}
public function supportsNormalization(mixed $data, string $format = null, array $context = []) : bool
{
Expand Down Expand Up @@ -55,7 +55,7 @@ public function normalize(mixed $object, string $format = null, array $context =
}
public function getSupportedTypes(?string $format = null) : array
{
return ['Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\Bar' => false];
return [\Jane\Component\JsonSchema\Tests\Expected\Model\Bar::class => false];
}
}
} else {
Expand All @@ -67,7 +67,7 @@ class BarNormalizer implements DenormalizerInterface, NormalizerInterface, Denor
use ValidatorTrait;
public function supportsDenormalization($data, $type, string $format = null, array $context = []) : bool
{
return $type === 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\Bar';
return $type === \Jane\Component\JsonSchema\Tests\Expected\Model\Bar::class;
}
public function supportsNormalization($data, $format = null, array $context = []) : bool
{
Expand Down Expand Up @@ -106,7 +106,7 @@ public function normalize($object, $format = null, array $context = [])
}
public function getSupportedTypes(?string $format = null) : array
{
return ['Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\Bar' => false];
return [\Jane\Component\JsonSchema\Tests\Expected\Model\Bar::class => false];
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BazBazNormalizer implements DenormalizerInterface, NormalizerInterface, De
use ValidatorTrait;
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []) : bool
{
return $type === 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\BazBaz';
return $type === \Jane\Component\JsonSchema\Tests\Expected\Model\BazBaz::class;
}
public function supportsNormalization(mixed $data, string $format = null, array $context = []) : bool
{
Expand All @@ -49,7 +49,7 @@ public function normalize(mixed $object, string $format = null, array $context =
}
public function getSupportedTypes(?string $format = null) : array
{
return ['Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\BazBaz' => false];
return [\Jane\Component\JsonSchema\Tests\Expected\Model\BazBaz::class => false];
}
}
} else {
Expand All @@ -61,7 +61,7 @@ class BazBazNormalizer implements DenormalizerInterface, NormalizerInterface, De
use ValidatorTrait;
public function supportsDenormalization($data, $type, string $format = null, array $context = []) : bool
{
return $type === 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\BazBaz';
return $type === \Jane\Component\JsonSchema\Tests\Expected\Model\BazBaz::class;
}
public function supportsNormalization($data, $format = null, array $context = []) : bool
{
Expand Down Expand Up @@ -94,7 +94,7 @@ public function normalize($object, $format = null, array $context = [])
}
public function getSupportedTypes(?string $format = null) : array
{
return ['Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\BazBaz' => false];
return [\Jane\Component\JsonSchema\Tests\Expected\Model\BazBaz::class => false];
}
}
}
16 changes: 8 additions & 8 deletions Tests/fixtures/all-of/expected/Normalizer/BazNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BazNormalizer implements DenormalizerInterface, NormalizerInterface, Denor
use ValidatorTrait;
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []) : bool
{
return $type === 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\Baz';
return $type === \Jane\Component\JsonSchema\Tests\Expected\Model\Baz::class;
}
public function supportsNormalization(mixed $data, string $format = null, array $context = []) : bool
{
Expand All @@ -38,10 +38,10 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
$object->setFoo($data['foo']);
}
if (\array_key_exists('Bar', $data)) {
$object->setBar($this->denormalizer->denormalize($data['Bar'], 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\Bar', 'json', $context));
$object->setBar($this->denormalizer->denormalize($data['Bar'], \Jane\Component\JsonSchema\Tests\Expected\Model\Bar::class, 'json', $context));
}
if (\array_key_exists('Baz', $data)) {
$object->setBaz($this->denormalizer->denormalize($data['Baz'], 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\BazBaz', 'json', $context));
$object->setBaz($this->denormalizer->denormalize($data['Baz'], \Jane\Component\JsonSchema\Tests\Expected\Model\BazBaz::class, 'json', $context));
}
return $object;
}
Expand All @@ -61,7 +61,7 @@ public function normalize(mixed $object, string $format = null, array $context =
}
public function getSupportedTypes(?string $format = null) : array
{
return ['Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\Baz' => false];
return [\Jane\Component\JsonSchema\Tests\Expected\Model\Baz::class => false];
}
}
} else {
Expand All @@ -73,7 +73,7 @@ class BazNormalizer implements DenormalizerInterface, NormalizerInterface, Denor
use ValidatorTrait;
public function supportsDenormalization($data, $type, string $format = null, array $context = []) : bool
{
return $type === 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\Baz';
return $type === \Jane\Component\JsonSchema\Tests\Expected\Model\Baz::class;
}
public function supportsNormalization($data, $format = null, array $context = []) : bool
{
Expand All @@ -92,10 +92,10 @@ public function denormalize($data, $type, $format = null, array $context = [])
$object->setFoo($data['foo']);
}
if (\array_key_exists('Bar', $data)) {
$object->setBar($this->denormalizer->denormalize($data['Bar'], 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\Bar', 'json', $context));
$object->setBar($this->denormalizer->denormalize($data['Bar'], \Jane\Component\JsonSchema\Tests\Expected\Model\Bar::class, 'json', $context));
}
if (\array_key_exists('Baz', $data)) {
$object->setBaz($this->denormalizer->denormalize($data['Baz'], 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\BazBaz', 'json', $context));
$object->setBaz($this->denormalizer->denormalize($data['Baz'], \Jane\Component\JsonSchema\Tests\Expected\Model\BazBaz::class, 'json', $context));
}
return $object;
}
Expand All @@ -118,7 +118,7 @@ public function normalize($object, $format = null, array $context = [])
}
public function getSupportedTypes(?string $format = null) : array
{
return ['Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\Baz' => false];
return [\Jane\Component\JsonSchema\Tests\Expected\Model\Baz::class => false];
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ChildtypeNormalizer implements DenormalizerInterface, NormalizerInterface,
use ValidatorTrait;
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []) : bool
{
return $type === 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\Childtype';
return $type === \Jane\Component\JsonSchema\Tests\Expected\Model\Childtype::class;
}
public function supportsNormalization(mixed $data, string $format = null, array $context = []) : bool
{
Expand Down Expand Up @@ -55,7 +55,7 @@ public function normalize(mixed $object, string $format = null, array $context =
}
public function getSupportedTypes(?string $format = null) : array
{
return ['Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\Childtype' => false];
return [\Jane\Component\JsonSchema\Tests\Expected\Model\Childtype::class => false];
}
}
} else {
Expand All @@ -67,7 +67,7 @@ class ChildtypeNormalizer implements DenormalizerInterface, NormalizerInterface,
use ValidatorTrait;
public function supportsDenormalization($data, $type, string $format = null, array $context = []) : bool
{
return $type === 'Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\Childtype';
return $type === \Jane\Component\JsonSchema\Tests\Expected\Model\Childtype::class;
}
public function supportsNormalization($data, $format = null, array $context = []) : bool
{
Expand Down Expand Up @@ -106,7 +106,7 @@ public function normalize($object, $format = null, array $context = [])
}
public function getSupportedTypes(?string $format = null) : array
{
return ['Jane\\Component\\JsonSchema\\Tests\\Expected\\Model\\Childtype' => false];
return [\Jane\Component\JsonSchema\Tests\Expected\Model\Childtype::class => false];
}
}
}
Loading

0 comments on commit 59d769d

Please sign in to comment.