diff --git a/composer.json b/composer.json index 075f3b1..5d27ae5 100644 --- a/composer.json +++ b/composer.json @@ -10,25 +10,25 @@ } ], "require": { - "php": "^8.0", + "php": "^8.4.2", "ext-json": "*", "cebe/php-openapi": "^1.7", "fakerphp/faker": "^1.20", "league/openapi-psr7-validator": "^0.18", - "thecodingmachine/safe": "^2.4" + "thecodingmachine/safe": "^3.0" }, "require-dev": { "doctrine/coding-standard": "^11", "ergebnis/composer-normalize": "^2.29", - "infection/infection": "^0.26", + "infection/infection": "^0.32", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.9", - "phpstan/phpstan-phpunit": "^1", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-phpunit": "^2.0", "phpunit/phpunit": "^9.5", - "rector/rector": "^0.15.2", + "rector/rector": "^2.4", "spatie/phpunit-snapshot-assertions": "^4.2", "symfony/var-dumper": "^6", - "thecodingmachine/phpstan-safe-rule": "^1.2" + "thecodingmachine/phpstan-safe-rule": "^1.4" }, "prefer-stable": true, "autoload": { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 61eb039..1339890 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,21 +1,2 @@ parameters: - ignoreErrors: - - - message: "#^Method Vural\\\\OpenAPIFaker\\\\OpenAPIFaker\\:\\:findComponentSchema\\(\\) should return cebe\\\\openapi\\\\spec\\\\Schema but returns cebe\\\\openapi\\\\spec\\\\Reference\\|cebe\\\\openapi\\\\spec\\\\Schema\\.$#" - count: 1 - path: src/OpenAPIFaker.php - - - - message: "#^Parameter \\#1 \\$schema of class Vural\\\\OpenAPIFaker\\\\SchemaFaker\\\\SchemaFaker constructor expects cebe\\\\openapi\\\\spec\\\\Schema, cebe\\\\openapi\\\\spec\\\\Reference\\|cebe\\\\openapi\\\\spec\\\\Schema\\|null given\\.$#" - count: 1 - path: src/SchemaFaker/ArrayFaker.php - - - - message: "#^Parameter \\#1 \\$schema of class Vural\\\\OpenAPIFaker\\\\SchemaFaker\\\\SchemaFaker constructor expects cebe\\\\openapi\\\\spec\\\\Schema, cebe\\\\openapi\\\\spec\\\\Reference\\|cebe\\\\openapi\\\\spec\\\\Schema\\|null given\\.$#" - count: 1 - path: src/SchemaFaker/RequestFaker.php - - - - message: "#^Parameter \\#1 \\$schema of class Vural\\\\OpenAPIFaker\\\\SchemaFaker\\\\SchemaFaker constructor expects cebe\\\\openapi\\\\spec\\\\Schema, cebe\\\\openapi\\\\spec\\\\Reference\\|cebe\\\\openapi\\\\spec\\\\Schema\\|null given\\.$#" - count: 1 - path: src/SchemaFaker/ResponseFaker.php \ No newline at end of file + ignoreErrors: \ No newline at end of file diff --git a/src/OpenAPIFaker.php b/src/OpenAPIFaker.php index 3808682..17c2915 100644 --- a/src/OpenAPIFaker.php +++ b/src/OpenAPIFaker.php @@ -23,8 +23,8 @@ use Vural\OpenAPIFaker\SchemaFaker\ResponseFaker; use Vural\OpenAPIFaker\SchemaFaker\SchemaFaker; +use function array_intersect_key; use function array_key_exists; -use function method_exists; use function strtolower; final class OpenAPIFaker @@ -46,7 +46,7 @@ private function __construct() public static function createFromJson(string $json): self { $instance = new self(); - $instance->openAPISchema = (new LeagueOpenAPI\SchemaFactory\JsonFactory($json))->createSchema(); + $instance->openAPISchema = new LeagueOpenAPI\SchemaFactory\JsonFactory($json)->createSchema(); return $instance; } @@ -58,7 +58,7 @@ public static function createFromJson(string $json): self public static function createFromYaml(string $yaml): self { $instance = new self(); - $instance->openAPISchema = (new LeagueOpenAPI\SchemaFactory\YamlFactory($yaml))->createSchema(); + $instance->openAPISchema = new LeagueOpenAPI\SchemaFactory\YamlFactory($yaml)->createSchema(); return $instance; } @@ -74,6 +74,7 @@ public static function createFromSchema(OpenApi $schema): self /** * @throws NoPath * @throws NoRequest + * @throws NoExample */ public function mockRequest( string $path, @@ -82,7 +83,7 @@ public function mockRequest( ): mixed { $content = $this->findContentForRequest($path, $method, $contentType); - return (new RequestFaker($content, $this->options))->generate(); + return new RequestFaker($content, $this->options)->generate(); } /** @@ -98,12 +99,13 @@ public function mockRequestForExample( ): mixed { $content = $this->findContentForRequest($path, $method, $contentType); - return (new RequestFaker($content, $this->options))->generate($exampleName); + return new RequestFaker($content, $this->options)->generate($exampleName); } /** * @throws NoPath * @throws NoResponse + * @throws NoExample */ public function mockResponse( string $path, @@ -113,7 +115,7 @@ public function mockResponse( ): mixed { $content = $this->findContentForResponse($path, $method, $statusCode, $contentType); - return (new ResponseFaker($content, $this->options))->generate(); + return new ResponseFaker($content, $this->options)->generate(); } /** @@ -130,7 +132,7 @@ public function mockResponseForExample( ): mixed { $content = $this->findContentForResponse($path, $method, $statusCode, $contentType); - return (new ResponseFaker($content, $this->options))->generate($exampleName); + return new ResponseFaker($content, $this->options)->generate($exampleName); } /** @throws Exception */ @@ -138,7 +140,7 @@ public function mockComponentSchema(string $schemaName): mixed { $schema = $this->findComponentSchema($schemaName); - return (new SchemaFaker($schema, $this->options))->generate(); + return new SchemaFaker($schema, $this->options)->generate(); } /** @throws Exception */ @@ -153,15 +155,18 @@ public function mockComponentSchemaForExample(string $schemaName): mixed return $schema->example; } - /** @param array{minItems?:?int, maxItems?:?int, alwaysFakeOptionals?:bool, strategy?:string} $options */ + /** @param array{minItems?:int|null, maxItems?:int|null, alwaysFakeOptionals?:bool, strategy?:string} $options */ public function setOptions(array $options): self { - foreach ($options as $key => $value) { - if (! method_exists($this->options, 'set' . $key)) { - continue; - } - - $this->options->{'set' . $key}($value); + $knownKeys = ['minItems' => 1, 'maxItems' => 1, 'alwaysFakeOptionals' => 1, 'strategy' => 1]; + + foreach (array_intersect_key($options, $knownKeys) as $key => $value) { + match ($key) { + 'minItems' => $value !== null ? $this->options->setMinItems($value) : null, + 'maxItems' => $value !== null ? $this->options->setMaxItems($value) : null, + 'alwaysFakeOptionals' => $this->options->setAlwaysFakeOptionals($value), + default => $this->options->setStrategy($value), + }; } return $this; @@ -171,7 +176,7 @@ public function setOptions(array $options): self private function findOperation(string $path, string $method): Operation { try { - $operation = (new LeagueOpenAPI\SpecFinder($this->openAPISchema)) + $operation = new LeagueOpenAPI\SpecFinder($this->openAPISchema) ->findOperationSpec(new LeagueOpenAPI\OperationAddress($path, strtolower($method))); } catch (LeagueOpenAPI\Exception\NoPath) { throw NoPath::forPathAndMethod($path, $method); @@ -254,6 +259,12 @@ private function findComponentSchema(string $schemaName): Schema throw NoSchema::forComponentName($schemaName); } - return $this->openAPISchema->components->schemas[$schemaName]; + $schema = $this->openAPISchema->components->schemas[$schemaName]; + + if (! $schema instanceof Schema) { + throw NoSchema::forComponentName($schemaName); + } + + return $schema; } } diff --git a/src/Options.php b/src/Options.php index 5a622f4..154eb6c 100644 --- a/src/Options.php +++ b/src/Options.php @@ -11,9 +11,9 @@ final class Options { - public const STRATEGY_STATIC = 'static'; + public const string STRATEGY_STATIC = 'static'; - public const STRATEGY_DYNAMIC = 'dynamic'; + public const string STRATEGY_DYNAMIC = 'dynamic'; private int|null $minItems = null; @@ -23,23 +23,23 @@ final class Options private string $strategy = self::STRATEGY_DYNAMIC; - private const ALLOWED = [self::STRATEGY_STATIC, self::STRATEGY_DYNAMIC]; + private const array ALLOWED = [self::STRATEGY_STATIC, self::STRATEGY_DYNAMIC]; - public function setMinItems(int $minItems): Options + public function setMinItems(int $minItems): self { $this->minItems = $minItems; return $this; } - public function setMaxItems(int $maxItems): Options + public function setMaxItems(int $maxItems): self { $this->maxItems = $maxItems; return $this; } - public function setAlwaysFakeOptionals(bool $alwaysFakeOptionals): Options + public function setAlwaysFakeOptionals(bool $alwaysFakeOptionals): self { $this->alwaysFakeOptionals = $alwaysFakeOptionals; @@ -47,7 +47,7 @@ public function setAlwaysFakeOptionals(bool $alwaysFakeOptionals): Options } /** @throws InvalidArgumentException */ - public function setStrategy(string $strategy): Options + public function setStrategy(string $strategy): self { if (! in_array($strategy, self::ALLOWED, true)) { throw new InvalidArgumentException(sprintf('Unknown generation strategy: %s', $strategy)); diff --git a/src/SchemaFaker/ArrayFaker.php b/src/SchemaFaker/ArrayFaker.php index cedc746..5bd59f4 100644 --- a/src/SchemaFaker/ArrayFaker.php +++ b/src/SchemaFaker/ArrayFaker.php @@ -9,11 +9,10 @@ use Vural\OpenAPIFaker\Options; use function array_unique; +use function array_values; use function count; -use function is_array; use const SORT_REGULAR; -use const SORT_STRING; /** @internal */ final class ArrayFaker @@ -30,12 +29,10 @@ public static function generate(Schema $schema, Options $options): array } if ($options->getMinItems() && $minimum < $options->getMinItems()) { - /** @var int $minimum */ $minimum = $options->getMinItems(); } if ($options->getMaxItems() && $maximum > $options->getMaxItems()) { - /** @var int $maximum */ $maximum = $options->getMaxItems(); // Don't allow user to set min items above our maximum @@ -48,6 +45,10 @@ public static function generate(Schema $schema, Options $options): array $fakeData = []; + if (! $schema->items instanceof Schema) { + return $fakeData; + } + $itemSchema = new SchemaFaker($schema->items, $options); for ($i = 0; $i < $itemSize; ++$i) { @@ -57,7 +58,7 @@ public static function generate(Schema $schema, Options $options): array continue; } - $uniqueData = array_unique($fakeData, is_array($fakeData[0]) ? SORT_REGULAR : SORT_STRING); + $uniqueData = array_unique($fakeData, SORT_REGULAR); if (count($uniqueData) > count($fakeData)) { continue; @@ -65,7 +66,7 @@ public static function generate(Schema $schema, Options $options): array $i -= count($fakeData) - count($uniqueData); - $fakeData = $uniqueData; + $fakeData = array_values($uniqueData); } return $fakeData; diff --git a/src/SchemaFaker/BooleanFaker.php b/src/SchemaFaker/BooleanFaker.php index 479205a..7996e80 100644 --- a/src/SchemaFaker/BooleanFaker.php +++ b/src/SchemaFaker/BooleanFaker.php @@ -25,7 +25,7 @@ public static function generate(Schema $schema, Options $options): bool|null private static function generateDynamic(Schema $schema): bool { - if ($schema->enum !== null) { + if (! empty($schema->enum)) { return Base::randomElement($schema->enum); } @@ -46,7 +46,7 @@ private static function generateStatic(Schema $schema): bool|null return null; } - if ($schema->enum !== null) { + if (! empty($schema->enum)) { $enums = $schema->enum; return reset($enums); diff --git a/src/SchemaFaker/NumberFaker.php b/src/SchemaFaker/NumberFaker.php index 5fe1197..38d5823 100644 --- a/src/SchemaFaker/NumberFaker.php +++ b/src/SchemaFaker/NumberFaker.php @@ -28,7 +28,7 @@ public static function generate(Schema $schema, Options $options): int|float|nul private static function generateDynamic(Schema $schema): int|float|null { - if ($schema->enum !== null) { + if (! empty($schema->enum)) { return Base::randomElement($schema->enum); } @@ -65,7 +65,7 @@ private static function generateStatic(Schema $schema): int|float|null return null; } - if ($schema->enum !== null) { + if (! empty($schema->enum)) { $enums = $schema->enum; return reset($enums); diff --git a/src/SchemaFaker/ObjectFaker.php b/src/SchemaFaker/ObjectFaker.php index 9dee776..cfa5b03 100644 --- a/src/SchemaFaker/ObjectFaker.php +++ b/src/SchemaFaker/ObjectFaker.php @@ -34,26 +34,29 @@ public static function generate(Schema $schema, Options $options, bool $request $allPropertyKeys = array_merge($requiredKeys, $selectedOptionalKeys); - /** @var Schema $property */ foreach ($schema->properties as $key => $property) { - if ($property instanceof Schema && (($request && $property->readOnly) || (! $request && $property->writeOnly))) { + if (! $property instanceof Schema) { + continue; + } + + if (($request && $property->readOnly) || (! $request && $property->writeOnly)) { continue; } if ( - ! $options->getAlwaysFakeOptionals() - && ! $useStaticStrategy + ! $useStaticStrategy + && ! $options->getAlwaysFakeOptionals() && ! in_array($key, $allPropertyKeys, true) ) { continue; } - $value = (new SchemaFaker($property, $options))->generate(); + $value = new SchemaFaker($property, $options)->generate(); if ( - ! $options->getAlwaysFakeOptionals() - && $useStaticStrategy + $useStaticStrategy && $property->nullable + && ! $options->getAlwaysFakeOptionals() ) { continue; } diff --git a/src/SchemaFaker/RequestFaker.php b/src/SchemaFaker/RequestFaker.php index 238351e..58b3d04 100644 --- a/src/SchemaFaker/RequestFaker.php +++ b/src/SchemaFaker/RequestFaker.php @@ -20,7 +20,7 @@ final class RequestFaker private Schema|Reference|null $schema = null; /** @var Example[]|Reference[] */ - private array $examples = []; + private array $examples; public function __construct(MediaType $mediaType, private Options $options) { @@ -35,22 +35,26 @@ public function __construct(MediaType $mediaType, private Options $options) */ public function generate(string|null $exampleName = null): array|string|bool|int|float|null { - if ($this->options->getStrategy() === Options::STRATEGY_STATIC && ! empty($this->examples)) { + if (! $this->schema instanceof Schema) { + return null; + } + + if (! empty($this->examples) && $this->options->getStrategy() === Options::STRATEGY_STATIC) { if ($exampleName !== null) { if (! array_key_exists($exampleName, $this->examples)) { throw NoExample::forRequest($exampleName); } - /** @var Example $exampleName */ - $exampleName = $this->examples[$exampleName]; + /** @var Example $exampleNameExample */ + $exampleNameExample = $this->examples[$exampleName]; } else { - /** @var Example $exampleName */ - $exampleName = reset($this->examples); + /** @var Example $exampleNameExample */ + $exampleNameExample = reset($this->examples); } - return $exampleName->value; + return $exampleNameExample->value; } - return (new SchemaFaker($this->schema, $this->options, true))->generate(); + return new SchemaFaker($this->schema, $this->options, true)->generate(); } } diff --git a/src/SchemaFaker/ResponseFaker.php b/src/SchemaFaker/ResponseFaker.php index a7b8904..db6dce0 100644 --- a/src/SchemaFaker/ResponseFaker.php +++ b/src/SchemaFaker/ResponseFaker.php @@ -17,10 +17,10 @@ /** @internal */ final class ResponseFaker { - private Schema|Reference|null $schema = null; + private Schema|Reference|null $schema; /** @var Example[]|Reference[] */ - private array $examples = []; + private array $examples; public function __construct(MediaType $mediaType, private Options $options) { @@ -35,22 +35,26 @@ public function __construct(MediaType $mediaType, private Options $options) */ public function generate(string|null $exampleName = null): array|string|bool|int|float|null { - if ($this->options->getStrategy() === Options::STRATEGY_STATIC && ! empty($this->examples)) { + if (! $this->schema instanceof Schema) { + return null; + } + + if (! empty($this->examples) && $this->options->getStrategy() === Options::STRATEGY_STATIC) { if ($exampleName !== null) { if (! array_key_exists($exampleName, $this->examples)) { throw NoExample::forResponse($exampleName); } - /** @var Example $exampleName */ - $exampleName = $this->examples[$exampleName]; + /** @var Example $exampleNameExample */ + $exampleNameExample = $this->examples[$exampleName]; } else { - /** @var Example $exampleName */ - $exampleName = reset($this->examples); + /** @var Example $exampleNameExample */ + $exampleNameExample = reset($this->examples); } - return $exampleName->value; + return $exampleNameExample->value; } - return (new SchemaFaker($this->schema, $this->options, false))->generate(); + return new SchemaFaker($this->schema, $this->options, false)->generate(); } } diff --git a/src/SchemaFaker/SchemaFaker.php b/src/SchemaFaker/SchemaFaker.php index 4c67d82..dc43a28 100644 --- a/src/SchemaFaker/SchemaFaker.php +++ b/src/SchemaFaker/SchemaFaker.php @@ -4,8 +4,10 @@ namespace Vural\OpenAPIFaker\SchemaFaker; +use cebe\openapi\exceptions\TypeErrorException; use cebe\openapi\spec\Schema; use Faker\Provider\Base; +use Safe\Exceptions\JsonException; use Vural\OpenAPIFaker\Options; use function array_key_exists; @@ -23,7 +25,11 @@ final class SchemaFaker { private Schema $schema; - public function __construct(Schema $schema, private Options $options, private bool $request = false) + /** + * @throws TypeErrorException + * @throws JsonException + */ + public function __construct(Schema $schema, private readonly Options $options, private readonly bool $request = false) { $schemaData = json_decode(json_encode($schema->getSerializableData()), true); $this->schema = new Schema($this->resolveOfConstraints($schemaData, $options)); @@ -52,7 +58,7 @@ public function generate(): array|string|bool|int|float|null return NumberFaker::generate($this->schema, $this->options); } - if ($this->schema->properties !== null) { + if (! empty($this->schema->properties)) { return ObjectFaker::generate($this->schema, $this->options); } diff --git a/src/SchemaFaker/StringFaker.php b/src/SchemaFaker/StringFaker.php index 15e9a76..7a55551 100644 --- a/src/SchemaFaker/StringFaker.php +++ b/src/SchemaFaker/StringFaker.php @@ -38,15 +38,15 @@ public static function generate(Schema $schema, Options $options): string|null private static function generateDynamic(Schema $schema): string { - if ($schema->enum !== null) { + if (! empty($schema->enum)) { return Base::randomElement($schema->enum); } - if ($schema->format !== null) { + if (! empty($schema->format)) { return self::generateDynamicFromFormat($schema); } - if ($schema->pattern !== null) { + if (! empty($schema->pattern)) { return Lorem::regexify($schema->pattern); } @@ -74,12 +74,12 @@ private static function generateDynamicFromFormat(Schema $schema): string return match ($schema->format) { 'date' => DateTime::date('Y-m-d', '2199-01-01'), 'date-time' => DateTime::dateTime('2199-01-01 00:00:00')->format(DATE_RFC3339), - 'email' => (new Internet(Factory::create()))->safeEmail(), + 'email' => new Internet(Factory::create())->safeEmail(), 'uuid' => Uuid::uuid(), - 'uri' => (new Internet(Factory::create()))->url(), - 'hostname' => (new Internet(Factory::create()))->domainName(), - 'ipv4' => (new Internet(Factory::create()))->ipv4(), - 'ipv6' => (new Internet(Factory::create()))->ipv6(), + 'uri' => new Internet(Factory::create())->url(), + 'hostname' => new Internet(Factory::create())->domainName(), + 'ipv4' => new Internet(Factory::create())->ipv4(), + 'ipv6' => new Internet(Factory::create())->ipv6(), 'byte' => base64_encode(Lorem::word()), 'binary' => StringUtils::convertToBinary(Lorem::word()), 'password' => Base::asciify(str_repeat('*', $maxLength)), @@ -101,17 +101,17 @@ private static function generateStatic(Schema $schema): string|null return null; } - if ($schema->enum !== null) { + if (! empty($schema->enum)) { $enums = $schema->enum; return reset($enums); } - if ($schema->format !== null) { + if (! empty($schema->format)) { return self::generateStaticFromFormat($schema); } - if ($schema->pattern !== null) { + if (! empty($schema->pattern)) { return RegexUtils::generateSample($schema->pattern); } @@ -128,7 +128,7 @@ private static function generateStaticFromFormat(Schema $schema): string return match ($schema->format) { 'date' => '2019-08-24', - 'date-time' => (new \Safe\DateTime('2019-08-24T14:15:22'))->format(DATE_RFC3339), + 'date-time' => new \Safe\DateTime('2019-08-24T14:15:22')->format(DATE_RFC3339), 'email' => 'user@example.com', 'uuid' => '095be615-a8ad-4c33-8e9c-c7612fbf6c9f', 'uri' => 'http://example.com', diff --git a/src/Utils/NumberUtils.php b/src/Utils/NumberUtils.php index d1c3a68..61a980a 100644 --- a/src/Utils/NumberUtils.php +++ b/src/Utils/NumberUtils.php @@ -12,17 +12,13 @@ public static function ensureRange(int|float $sample, int|float|null $minimum, i { if ($minimum === null) { $minimum = $sample; + } elseif ($minimum > $sample) { + $sample = $minimum; } if ($maximum === null) { $maximum = $minimum; - } - - if ($minimum > $sample) { - $sample = $minimum; - } - - if ($maximum < $sample) { + } elseif ($maximum < $sample) { $sample = $maximum; } diff --git a/src/Utils/RegexUtils.php b/src/Utils/RegexUtils.php index ef77332..77aeba1 100644 --- a/src/Utils/RegexUtils.php +++ b/src/Utils/RegexUtils.php @@ -4,9 +4,11 @@ namespace Vural\OpenAPIFaker\Utils; +use Safe\Exceptions\PcreException; + use function explode; -use function preg_replace_callback; use function Safe\preg_replace; +use function Safe\preg_replace_callback; use function str_repeat; use function str_replace; use function str_split; @@ -14,6 +16,7 @@ /** @internal */ final class RegexUtils { + /** @throws PcreException */ public static function generateSample(string $regex): string { // ditch the anchors @@ -28,13 +31,13 @@ public static function generateSample(string $regex): string // [12]{1,2} becomes [12] $regex = preg_replace_callback('#(\[[^\]]+\])\{(\d+),(\d+)\}#', static fn ($matches): string => str_repeat($matches[1], (int) $matches[2]), $regex); // (12|34){1,2} becomes (12|34) - $regex = preg_replace_callback('#(\([^\)]+\))\{(\d+),(\d+)\}#', static fn ($matches): string => str_repeat($matches[1], (int) $matches[2]), $regex ?? ''); + $regex = preg_replace_callback('#(\([^\)]+\))\{(\d+),(\d+)\}#', static fn ($matches): string => str_repeat($matches[1], (int) $matches[2]), $regex); // A{1,2} becomes A or \d{3} becomes \d\d\d - $regex = preg_replace_callback('#(\\\?.)\{(\d+),(\d+)\}#', static fn ($matches): string => str_repeat($matches[1], (int) $matches[2]), $regex ?? ''); + $regex = preg_replace_callback('#(\\\?.)\{(\d+),(\d+)\}#', static fn ($matches): string => str_repeat($matches[1], (int) $matches[2]), $regex); // (this|that) becomes 'this' - $regex = preg_replace_callback('#\((.*?)\)#', static fn ($matches): string => explode('|', str_replace(['(', ')'], '', $matches[1]))[0], $regex ?? ''); + $regex = preg_replace_callback('#\((.*?)\)#', static fn ($matches): string => explode('|', str_replace(['(', ')'], '', $matches[1]))[0], $regex); // [A-F] become [A] or [0-9] becomes [0] - $regex = preg_replace_callback('#\[([^\]]+)\]#', static fn ($matches): string => '[' . preg_replace_callback('#(\w|\d)\-(\w|\d)#', static fn ($range): string => $range[1], $matches[1]) . ']', $regex ?? ''); + $regex = preg_replace_callback('#\[([^\]]+)\]#', static fn ($matches): string => '[' . preg_replace_callback('#(\w|\d)\-(\w|\d)#', static fn ($range): string => $range[1], $matches[1]) . ']', $regex); // All [ABC] become A $regex = preg_replace_callback('#\[([^\]]+)\]#', static function ($matches): string { // remove backslashes (that are not followed by another backslash) because they are escape characters @@ -43,9 +46,9 @@ public static function generateSample(string $regex): string //[.] should not be a character, but a literal . return str_replace('.', '\.', $firstElement); - }, $regex ?? ''); + }, $regex); // replace \d with number 1 and \w with letter a - $regex = preg_replace('/\\\w/', 'a', $regex ?? ''); + $regex = preg_replace('/\\\w/', 'a', $regex); $regex = preg_replace('/\\\d/', '1', $regex); //replace . with ! $regex = preg_replace('/(?schema instanceof Schema) { + continue; + } + if ($mediaType->schema->description !== 'Video search results') { continue; } @@ -103,7 +107,7 @@ function it_can_generate_valid_response(string $filename, string $strategy) } } - self::assertTrue(true); + self::addToAssertionCount(1); } /** @@ -133,7 +137,7 @@ function it_can_generate_valid_component(string $filename, string $strategy) } } - self::assertTrue(true); + self::addToAssertionCount(1); } /** @@ -167,7 +171,7 @@ function it_can_generate_valid_component_examples(string $filename, string $stra } } - self::assertTrue(true); + self::addToAssertionCount(1); } /** @return string[][] */ diff --git a/tests/Integration/OpenAPIFakerTest.php b/tests/Integration/OpenAPIFakerTest.php index 386e06c..35d5f0a 100644 --- a/tests/Integration/OpenAPIFakerTest.php +++ b/tests/Integration/OpenAPIFakerTest.php @@ -79,7 +79,7 @@ function it_can_create_faker_from_json() $faker = OpenAPIFaker::createFromJson($specJson); - self::assertInstanceOf(OpenAPIFaker::class, $faker); + self::assertInstanceOf(OpenAPIFaker::class, $faker); // @phpstan-ignore-line } /** @@ -134,7 +134,7 @@ function it_can_create_faker_from_yaml() $faker = OpenAPIFaker::createFromYaml($specYaml); - self::assertInstanceOf(OpenAPIFaker::class, $faker); + self::assertInstanceOf(OpenAPIFaker::class, $faker); // @phpstan-ignore-line } /** @@ -190,14 +190,13 @@ function it_can_create_faker_from_schema() $schema = new OpenApi(Yaml::parse($specYaml)); $faker = OpenAPIFaker::createFromSchema($schema); - self::assertInstanceOf(OpenAPIFaker::class, $faker); + self::assertInstanceOf(OpenAPIFaker::class, $faker); // @phpstan-ignore-line } /** * @test - * @testWith - * ["/todos", "get"] - * ["/todos", "post", "text/plain"] + * @testWith ["/todos", "get"] + * ["/todos", "post", "text/plain"] */ function it_throws_exception_if_request_cannot_be_found(string $path, string $method, string $contentType = 'application/json') { @@ -251,10 +250,9 @@ function it_throws_exception_if_request_cannot_be_found(string $path, string $me /** * @test - * @testWith - * ["/todos", "post"] - * ["/todos", "get", "201"] - * ["/todos", "get", "200", "text/plain"] + * @testWith ["/todos", "post"] + * ["/todos", "get", "201"] + * ["/todos", "get", "200", "text/plain"] */ function it_throws_exception_if_response_cannot_be_found(string $path, string $method, string $statusCode = '200', string $contentType = 'application/json') { @@ -558,8 +556,6 @@ function it_will_mock_the_request() self::assertIsArray($fakeData); self::assertGreaterThanOrEqual(0, count($fakeData)); - - self::assertIsArray($fakeData); self::assertArrayHasKey('id', $fakeData); self::assertIsInt($fakeData['id']); self::assertArrayHasKey('name', $fakeData); diff --git a/tests/Unit/SchemaFaker/ArrayFakerTest.php b/tests/Unit/SchemaFaker/ArrayFakerTest.php index 4b300a7..38bb01c 100644 --- a/tests/Unit/SchemaFaker/ArrayFakerTest.php +++ b/tests/Unit/SchemaFaker/ArrayFakerTest.php @@ -12,9 +12,7 @@ use function array_unique; use function count; use function mt_srand; -use function Safe\sort; - -use const MT_RAND_PHP; +use function sort; /** * @uses \Vural\OpenAPIFaker\SchemaFaker\SchemaFaker @@ -142,7 +140,7 @@ function it_handles_nested_arrays() /** @test */ function it_can_generate_unique_elements() { - mt_srand(227, MT_RAND_PHP); + mt_srand(227); $fakeData = ArrayFaker::generate(SchemaFactory::fromJson( <<<'JSON' @@ -160,7 +158,6 @@ function it_can_generate_unique_elements() JSON, ), $this->options); - self::assertIsArray($fakeData); self::assertCount(5, $fakeData); self::assertSame($fakeData, array_unique($fakeData)); } diff --git a/tests/Unit/SchemaFaker/NumberFakerTest.php b/tests/Unit/SchemaFaker/NumberFakerTest.php index db296a6..b9d5b25 100644 --- a/tests/Unit/SchemaFaker/NumberFakerTest.php +++ b/tests/Unit/SchemaFaker/NumberFakerTest.php @@ -229,7 +229,7 @@ function it_can_handle_multiple_of_keyword_with_float_number() $fakeData = NumberFaker::generate(SchemaFactory::fromYaml($yaml), $this->options); self::assertIsFloat($fakeData); - self::assertSame(0, $fakeData % 8); + self::assertSame(0, (int) $fakeData % 8); } /** @test */ diff --git a/tests/Unit/SchemaFaker/ObjectFakerTest.php b/tests/Unit/SchemaFaker/ObjectFakerTest.php index d523762..4b41825 100644 --- a/tests/Unit/SchemaFaker/ObjectFakerTest.php +++ b/tests/Unit/SchemaFaker/ObjectFakerTest.php @@ -96,7 +96,6 @@ function it_includes_required_properties_all_the_time() $fakeData = ObjectFaker::generate(SchemaFactory::fromYaml($yaml), $this->options); - self::assertIsArray($fakeData); self::assertArrayHasKey('id', $fakeData); self::assertArrayHasKey('username', $fakeData); $this->assertMatchesJsonSnapshot($fakeData); @@ -130,7 +129,6 @@ function it_can_fake_all_properties_if_always_fake_optionals_option_is_set() $fakeData = ObjectFaker::generate(SchemaFactory::fromYaml($yaml), $options); - self::assertIsArray($fakeData); self::assertCount(6, $fakeData); $this->assertMatchesJsonSnapshot($fakeData); @@ -158,7 +156,6 @@ function it_does_not_inlcude_readonly_properties_when_type_is_request() $fakeData = ObjectFaker::generate(SchemaFactory::fromYaml($yaml), $this->options, true); - self::assertIsArray($fakeData); self::assertArrayNotHasKey('id', $fakeData); self::assertArrayHasKey('username', $fakeData); self::assertArrayHasKey('password', $fakeData); @@ -188,7 +185,6 @@ function it_does_not_inlcude_writeonly_properties_when_type_is_response() $fakeData = ObjectFaker::generate(SchemaFactory::fromYaml($yaml), $this->options); - self::assertIsArray($fakeData); self::assertArrayHasKey('id', $fakeData); self::assertArrayHasKey('username', $fakeData); self::assertArrayNotHasKey('password', $fakeData); diff --git a/tests/Unit/SchemaFaker/SchemaFakerTest.php b/tests/Unit/SchemaFaker/SchemaFakerTest.php index 60bd485..271e71c 100644 --- a/tests/Unit/SchemaFaker/SchemaFakerTest.php +++ b/tests/Unit/SchemaFaker/SchemaFakerTest.php @@ -12,6 +12,8 @@ use Vural\OpenAPIFaker\Tests\Unit\UnitTestCase; use function array_keys; +use function is_array; +use function is_int; /** * @uses \Vural\OpenAPIFaker\SchemaFaker\StringFaker @@ -179,7 +181,10 @@ function it_can_recursively_merge_of_constraints() self::assertArrayHasKey('bar', $fakeData); self::assertArrayHasKey('baz', $fakeData); self::assertArrayHasKey('bap', $fakeData); - $this->assertMatchesJsonSnapshot($fakeData); + self::assertIsInt($fakeData['foo']); + self::assertMatchesRegularExpression('/^\d{4}-\d{2}-\d{2}$/', $fakeData['bar']); + self::assertIsString($fakeData['baz']); + self::assertSame('compact', $fakeData['bap']); } /** @test */ @@ -255,7 +260,13 @@ enum: self::assertArrayHasKey('type', $fakeData); self::assertArrayHasKey('title', $fakeData); self::assertArrayHasKey('detail', $fakeData); - $this->assertMatchesJsonSnapshot($fakeData); + self::assertIsString($fakeData['resource_id']); + self::assertSame('tweet', $fakeData['resource_type']); + self::assertContains($fakeData['section'], ['data', 'includes']); + self::assertSame('https://api.twitter.com/labs/1/problems/not-authorized-for-resource', $fakeData['type']); + self::assertIsString($fakeData['title']); + self::assertIsString($fakeData['detail']); + self::assertTrue(is_int($fakeData['foo']) || is_array($fakeData['foo'])); } /** @test */ diff --git a/tests/Unit/SchemaFaker/StaticObjectFakerTest.php b/tests/Unit/SchemaFaker/StaticObjectFakerTest.php index 00f1bdb..ec4dab8 100644 --- a/tests/Unit/SchemaFaker/StaticObjectFakerTest.php +++ b/tests/Unit/SchemaFaker/StaticObjectFakerTest.php @@ -57,7 +57,6 @@ function it_can_fake_all_properties_if_static_strategy_option_is_set() $fakeData = ObjectFaker::generate(SchemaFactory::fromYaml($yaml), $this->options); - self::assertIsArray($fakeData); self::assertCount(6, $fakeData); $this->assertMatchesJsonSnapshot($fakeData); @@ -83,8 +82,6 @@ function it_can_generate_example_value() $fakeData = ObjectFaker::generate(SchemaFactory::fromYaml($yaml), $this->options); - self::assertIsArray($fakeData); - $this->assertMatchesJsonSnapshot($fakeData); } } diff --git a/tests/Unit/SchemaFaker/StringFakerTest.php b/tests/Unit/SchemaFaker/StringFakerTest.php index 7cadd46..0e7cb71 100644 --- a/tests/Unit/SchemaFaker/StringFakerTest.php +++ b/tests/Unit/SchemaFaker/StringFakerTest.php @@ -11,7 +11,7 @@ use Vural\OpenAPIFaker\Tests\Unit\UnitTestCase; use function filter_var; -use function Safe\sprintf; +use function sprintf; use function strlen; use const FILTER_VALIDATE_URL; diff --git a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_generate_elements_from_enum__1.json b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_generate_elements_from_enum__1.json index 63da332..e805179 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_generate_elements_from_enum__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_generate_elements_from_enum__1.json @@ -1,18 +1,13 @@ [ - 88, - 88, - 4, - 88, - 4, - 4, 6789, - 88, 6789, - 6789, - 4, 4, 4, + 88, + 6789, 4, 4, - 88 + 6789, + 88, + 4 ] diff --git a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_generate_items__1.json b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_generate_items__1.json index 266ba2e..745aeb3 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_generate_items__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_generate_items__1.json @@ -1,8 +1,3 @@ [ - "laborum", - "in", - "eaque", - "harum", - "veniam", - "veritatis" + "odit" ] diff --git a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_handle_both_min_and_max_items__1.json b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_handle_both_min_and_max_items__1.json index 4040373..796b3c0 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_handle_both_min_and_max_items__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_handle_both_min_and_max_items__1.json @@ -1,11 +1,10 @@ [ - "laborum", - "in", - "eaque", - "harum", - "veniam", - "veritatis", - "cumque", - "totam", - "reiciendis" + "odit", + "nobis", + "aut", + "placeat", + "qui", + "ut", + "dolores", + "aspernatur" ] diff --git a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_handle_max_items__1.json b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_handle_max_items__1.json index 2e4e9b1..c793fa2 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_handle_max_items__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_handle_max_items__1.json @@ -1,6 +1,12 @@ [ - "laborum", - "in", - "eaque", - "harum" + "odit", + "nobis", + "aut", + "placeat", + "qui", + "ut", + "dolores", + "aspernatur", + "ut", + "qui" ] diff --git a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_handle_min_items__1.json b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_handle_min_items__1.json index 4040373..1196e02 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_handle_min_items__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_handle_min_items__1.json @@ -1,11 +1,6 @@ [ - "laborum", - "in", - "eaque", - "harum", - "veniam", - "veritatis", - "cumque", - "totam", - "reiciendis" + "odit", + "nobis", + "aut", + "placeat" ] diff --git a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_both_minimum_and_maximum_items_with_options__1.json b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_both_minimum_and_maximum_items_with_options__1.json index 2f5b864..c7eefbc 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_both_minimum_and_maximum_items_with_options__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_both_minimum_and_maximum_items_with_options__1.json @@ -1,5 +1,5 @@ [ - 488690146, - 321051476, - -1983034482 + -474531056, + 321051478, + 2002428260 ] diff --git a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_maximum_items_with_option__1.json b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_maximum_items_with_option__1.json index 0708075..2f36e51 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_maximum_items_with_option__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_maximum_items_with_option__1.json @@ -1,3 +1,3 @@ [ - 488690146 + -474531056 ] diff --git a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_minimum_if_its_greater_than_maximum__1.json b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_minimum_if_its_greater_than_maximum__1.json index d8bbd19..7fd11cb 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_minimum_if_its_greater_than_maximum__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_minimum_if_its_greater_than_maximum__1.json @@ -1,6 +1,6 @@ [ - 488690146, - 321051476, - -1983034482, - 572039736 + -474531056, + 321051478, + 2002428260, + -594589483 ] diff --git a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_minimum_items_with_option__1.json b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_minimum_items_with_option__1.json index a88793a..70a0bdc 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_minimum_items_with_option__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_can_override_minimum_items_with_option__1.json @@ -1,12 +1,16 @@ [ - 488690146, - 321051476, - -1983034482, - 572039736, - -933357512, - -1879644922, - 858398568, - -142637466, - 2046609882, - 1911609916 + -474531056, + 321051478, + 2002428260, + -594589483, + -933357510, + -1879644920, + 858398570, + -142637464, + -2023021769, + 1911609918, + 1732967516, + 1885698592, + -1817074197, + 1131664203 ] diff --git a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_handles_nested_arrays__1.json b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_handles_nested_arrays__1.json index 53aa8b7..8cab2bb 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_handles_nested_arrays__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_handles_nested_arrays__1.json @@ -1,38 +1,19 @@ [ [ - "in", - "eaque", - "harum", - "veniam", - "veritatis", - "cumque", - "totam", - "reiciendis", - "rerum" - ], - [ - "inventore" - ], - [ - "et" - ], - [ - "perspiciatis", - "ad", - "et" - ], - [ - "reprehenderit", - "quam", - "voluptates", - "non", - "odio" - ], - [ + "nobis", + "aut", "placeat", - "nihil", + "qui", + "ut", + "dolores", + "aspernatur", "ut", - "possimus", - "cumque" + "qui", + "eius", + "aperiam", + "qui", + "voluptatum", + "iste", + "est" ] ] diff --git a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_will_not_override_maximum_items_with_option_if_option_is_greater__1.json b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_will_not_override_maximum_items_with_option_if_option_is_greater__1.json index 2f5b864..c7eefbc 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_will_not_override_maximum_items_with_option_if_option_is_greater__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_will_not_override_maximum_items_with_option_if_option_is_greater__1.json @@ -1,5 +1,5 @@ [ - 488690146, - 321051476, - -1983034482 + -474531056, + 321051478, + 2002428260 ] diff --git a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_will_not_override_minimum_items_with_option_if_option_is_smaller__1.json b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_will_not_override_minimum_items_with_option_if_option_is_smaller__1.json index 2f5b864..c7eefbc 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_will_not_override_minimum_items_with_option_if_option_is_smaller__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_will_not_override_minimum_items_with_option_if_option_is_smaller__1.json @@ -1,5 +1,5 @@ [ - 488690146, - 321051476, - -1983034482 + -474531056, + 321051478, + 2002428260 ] diff --git a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_will_use_minimum_plus_15_as_max_items_if_its_not_given__1.json b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_will_use_minimum_plus_15_as_max_items_if_its_not_given__1.json index 266ba2e..745aeb3 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_will_use_minimum_plus_15_as_max_items_if_its_not_given__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ArrayFakerTest__it_will_use_minimum_plus_15_as_max_items_if_its_not_given__1.json @@ -1,8 +1,3 @@ [ - "laborum", - "in", - "eaque", - "harum", - "veniam", - "veritatis" + "odit" ] diff --git a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_generate_a_integer__1.json b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_generate_a_integer__1.json index e2ca84c..7e01bbd 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_generate_a_integer__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_generate_a_integer__1.json @@ -1 +1 @@ --472434772 +490790210 diff --git a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_generate_a_number__1.json b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_generate_a_number__1.json index 7d392d9..c3ac6fc 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_generate_a_number__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_generate_a_number__1.json @@ -1 +1 @@ -488690147 +-474531057.0000001 diff --git a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_generate_elements_from_enum__1.json b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_generate_elements_from_enum__1.json index 80ef413..6b2a722 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_generate_elements_from_enum__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_generate_elements_from_enum__1.json @@ -1 +1 @@ --123.321 +1010.9865 diff --git a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_both_minimum_and_maximum_keyword__1.json b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_both_minimum_and_maximum_keyword__1.json index d932c05..8f4b30e 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_both_minimum_and_maximum_keyword__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_both_minimum_and_maximum_keyword__1.json @@ -1 +1 @@ -161.378 +138.9514629 diff --git a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_exclusive_maximum_keyword__1.json b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_exclusive_maximum_keyword__1.json index 29d6383..398050c 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_exclusive_maximum_keyword__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_exclusive_maximum_keyword__1.json @@ -1 +1 @@ -100 +101 diff --git a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_exclusive_minimum_keyword__1.json b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_exclusive_minimum_keyword__1.json index 398050c..257e563 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_exclusive_minimum_keyword__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_exclusive_minimum_keyword__1.json @@ -1 +1 @@ -101 +102 diff --git a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_integer_int32_format__1.json b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_integer_int32_format__1.json index e2ca84c..7e01bbd 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_integer_int32_format__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_integer_int32_format__1.json @@ -1 +1 @@ --472434772 +490790210 diff --git a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_integer_int64_format__1.json b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_integer_int64_format__1.json index e2ca84c..7e01bbd 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_integer_int64_format__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_integer_int64_format__1.json @@ -1 +1 @@ --472434772 +490790210 diff --git a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_maximum_keyword__1.json b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_maximum_keyword__1.json index 0c32d34..4a1f959 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_maximum_keyword__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_maximum_keyword__1.json @@ -1 +1 @@ --1309959170 +-474531056 diff --git a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_minimum_keyword__1.json b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_minimum_keyword__1.json index 9d8a4d0..cbee5d2 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_minimum_keyword__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_minimum_keyword__1.json @@ -1 +1 @@ -837524498 +490790409 diff --git a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_number_double_format__1.json b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_number_double_format__1.json index 7d392d9..c3ac6fc 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_number_double_format__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_number_double_format__1.json @@ -1 +1 @@ -488690147 +-474531057.0000001 diff --git a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_number_float_format__1.json b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_number_float_format__1.json index 7d392d9..c3ac6fc 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_number_float_format__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/NumberFakerTest__it_can_handle_number_float_format__1.json @@ -1 +1 @@ -488690147 +-474531057.0000001 diff --git a/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_can_fake_all_properties_if_always_fake_optionals_option_is_set__1.json b/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_can_fake_all_properties_if_always_fake_optionals_option_is_set__1.json index e322d77..4ce37b8 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_can_fake_all_properties_if_always_fake_optionals_option_is_set__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_can_fake_all_properties_if_always_fake_optionals_option_is_set__1.json @@ -1,8 +1,8 @@ { - "id": 321051476, - "username": "eaque", - "name": "harum", - "age": -933357512, + "id": 2002428260, + "username": "placeat", + "name": "qui", + "age": -1879644920, "birthdate": [], - "email": "weston94@example.com" + "email": "tess.crooks@example.com" } diff --git a/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_can_generate_nested_objects__1.json b/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_can_generate_nested_objects__1.json index eb0673d..5288110 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_can_generate_nested_objects__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_can_generate_nested_objects__1.json @@ -1,3 +1,6 @@ { - "name": "in" + "contact_info": { + "email": "polly.kessler@example.net", + "phone": "qui" + } } diff --git a/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_can_generate_simple_object__1.json b/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_can_generate_simple_object__1.json index eb0673d..fe51488 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_can_generate_simple_object__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_can_generate_simple_object__1.json @@ -1,3 +1 @@ -{ - "name": "in" -} +[] diff --git a/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_does_not_inlcude_readonly_properties_when_type_is_request__1.json b/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_does_not_inlcude_readonly_properties_when_type_is_request__1.json index 6900424..a5624c6 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_does_not_inlcude_readonly_properties_when_type_is_request__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_does_not_inlcude_readonly_properties_when_type_is_request__1.json @@ -1,4 +1,4 @@ { - "username": "laborum", - "password": "in" + "username": "odit", + "password": "nobis" } diff --git a/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_does_not_inlcude_writeonly_properties_when_type_is_response__1.json b/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_does_not_inlcude_writeonly_properties_when_type_is_response__1.json index f60b676..15a6577 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_does_not_inlcude_writeonly_properties_when_type_is_response__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_does_not_inlcude_writeonly_properties_when_type_is_response__1.json @@ -1,4 +1,4 @@ { - "id": 488690146, - "username": "in" + "id": -474531056, + "username": "nobis" } diff --git a/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_includes_required_properties_all_the_time__1.json b/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_includes_required_properties_all_the_time__1.json index 3df0a16..f4794dd 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_includes_required_properties_all_the_time__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ObjectFakerTest__it_includes_required_properties_all_the_time__1.json @@ -1,5 +1,6 @@ { - "id": 321051476, - "username": "eaque", - "birthdate": [] + "id": 2002428260, + "username": "placeat", + "age": -933357510, + "email": "ppouros@example.net" } diff --git a/tests/Unit/SchemaFaker/__snapshots__/RequestFakerTest__it_will_mock_the_request__1.json b/tests/Unit/SchemaFaker/__snapshots__/RequestFakerTest__it_will_mock_the_request__1.json index 544344e..716fbe6 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/RequestFakerTest__it_will_mock_the_request__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/RequestFakerTest__it_will_mock_the_request__1.json @@ -1,4 +1,5 @@ { - "id": 488690146, - "name": "in" + "id": 321051478, + "name": "aut", + "tag": "placeat" } diff --git a/tests/Unit/SchemaFaker/__snapshots__/ResponseFakerTest__it_will_mock_the_response__1.json b/tests/Unit/SchemaFaker/__snapshots__/ResponseFakerTest__it_will_mock_the_response__1.json index af93109..036b549 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/ResponseFakerTest__it_will_mock_the_response__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/ResponseFakerTest__it_will_mock_the_response__1.json @@ -1,7 +1,7 @@ { "todo": { - "id": -1983034482, - "name": "harum", - "tag": "veniam" + "id": 2002428260, + "name": "placeat", + "tag": "qui" } } diff --git a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__allof_merge__1.json b/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__allof_merge__1.json index fb493fe..885ccab 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__allof_merge__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__allof_merge__1.json @@ -1,6 +1,6 @@ { - "status": 321051476, + "status": 321051478, "type": "about:blank", - "detail": "harum", - "title": "veniam" + "detail": "placeat", + "title": "qui" } diff --git a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__another_merge_test__1.json b/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__another_merge_test__1.json index b56e554..dd02460 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__another_merge_test__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__another_merge_test__1.json @@ -1,6 +1,6 @@ { - "status": 321051476, + "status": 321051478, "type": "http:\/\/example.com", - "detail": "harum", - "title": "veniam" + "detail": "placeat", + "title": "qui" } diff --git a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_can_choose_one_schema_from_one_of__1.txt b/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_can_choose_one_schema_from_one_of__1.txt index 9bbd50d..2ca78cb 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_can_choose_one_schema_from_one_of__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_can_choose_one_schema_from_one_of__1.txt @@ -1 +1 @@ -73.254.74.206 \ No newline at end of file +3b0f:db55:a163:48d4:1839:e507:1f69:8667 \ No newline at end of file diff --git a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_can_merge_all_of_with_other_properties__1.json b/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_can_merge_all_of_with_other_properties__1.json deleted file mode 100644 index d7a8dd0..0000000 --- a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_can_merge_all_of_with_other_properties__1.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "resource_id": "in", - "resource_type": "tweet", - "section": "includes", - "type": "https:\/\/api.twitter.com\/labs\/1\/problems\/not-authorized-for-resource", - "detail": "veritatis", - "title": "cumque", - "foo": { - "loop": [] - } -} diff --git a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_can_merge_schemas_from_all_of__1.json b/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_can_merge_schemas_from_all_of__1.json index 28efc01..0edcde1 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_can_merge_schemas_from_all_of__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_can_merge_schemas_from_all_of__1.json @@ -1,5 +1,5 @@ { - "age": 1318086903, - "name": "in", - "email": "nader.arno@example.net" + "age": 1672952609, + "name": "nobis", + "email": "dheaney@example.net" } diff --git a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_can_recursively_merge_of_constraints__1.json b/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_can_recursively_merge_of_constraints__1.json deleted file mode 100644 index 8c24af7..0000000 --- a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_can_recursively_merge_of_constraints__1.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "baz": "harum", - "bar": "2034-09-26", - "foo": -1879644922, - "bap": "compact" -} diff --git a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_will_merge_all_of_with_existing_schema__1.json b/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_will_merge_all_of_with_existing_schema__1.json index beaf2f3..df78c97 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_will_merge_all_of_with_existing_schema__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_will_merge_all_of_with_existing_schema__1.json @@ -1,3 +1,4 @@ { - "format": "compact" + "format": "compact", + "id": -594589483 } diff --git a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_will_merge_one_of_with_existing_schema__1.json b/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_will_merge_one_of_with_existing_schema__1.json index 164ee93..beaf2f3 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_will_merge_one_of_with_existing_schema__1.json +++ b/tests/Unit/SchemaFaker/__snapshots__/SchemaFakerTest__it_will_merge_one_of_with_existing_schema__1.json @@ -1,4 +1,3 @@ { - "id": -1983034482, "format": "compact" } diff --git a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_generate_elements_from_enum__1.txt b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_generate_elements_from_enum__1.txt index ba0e162..1910281 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_generate_elements_from_enum__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_generate_elements_from_enum__1.txt @@ -1 +1 @@ -bar \ No newline at end of file +foo \ No newline at end of file diff --git a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_generate_single_string__1.txt b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_generate_single_string__1.txt index f820d12..d34ed81 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_generate_single_string__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_generate_single_string__1.txt @@ -1 +1 @@ -reprehenderit \ No newline at end of file +laboriosam \ No newline at end of file diff --git a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_binary_format__1.txt b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_binary_format__1.txt index 7167931..b74c3a0 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_binary_format__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_binary_format__1.txt @@ -1 +1 @@ -1110010 1100101 1110000 1110010 1100101 1101000 1100101 1101110 1100100 1100101 1110010 1101001 1110100 \ No newline at end of file +1101100 1100001 1100010 1101111 1110010 1101001 1101111 1110011 1100001 1101101 \ No newline at end of file diff --git a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_byte_format__1.txt b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_byte_format__1.txt index ea33b68..cdd17bf 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_byte_format__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_byte_format__1.txt @@ -1 +1 @@ -cmVwcmVoZW5kZXJpdA== \ No newline at end of file +bGFib3Jpb3NhbQ== \ No newline at end of file diff --git a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_email_format__1.txt b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_email_format__1.txt index 2db2674..e63de33 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_email_format__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_email_format__1.txt @@ -1 +1 @@ -lavonne.batz@example.org \ No newline at end of file +otha.bruen@example.com \ No newline at end of file diff --git a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_hostname_format__1.txt b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_hostname_format__1.txt index e13336e..99a30b7 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_hostname_format__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_hostname_format__1.txt @@ -1 +1 @@ -howell.biz \ No newline at end of file +zulauf.com \ No newline at end of file diff --git a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_ipv4_format__1.txt b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_ipv4_format__1.txt index 72f0b2d..58fad8b 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_ipv4_format__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_ipv4_format__1.txt @@ -1 +1 @@ -206.144.104.240 \ No newline at end of file +100.183.59.15 \ No newline at end of file diff --git a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_ipv6_format__1.txt b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_ipv6_format__1.txt index 88baf42..870c30a 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_ipv6_format__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_ipv6_format__1.txt @@ -1 +1 @@ -63d7:9d20:9322:9cd:a218:485e:ff6:b32a \ No newline at end of file +dd41:3b0f:db55:a163:48d4:1839:e507:1f69 \ No newline at end of file diff --git a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_max_length__1.txt b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_max_length__1.txt index 65f84b7..147cc7c 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_max_length__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_max_length__1.txt @@ -1 +1 @@ -rep \ No newline at end of file +lab \ No newline at end of file diff --git a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_min_length__1.txt b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_min_length__1.txt index 67c0532..1737224 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_min_length__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_min_length__1.txt @@ -1 +1 @@ -reprehenderitlaborumineaque \ No newline at end of file +laboriosamoditnobisautplaceat \ No newline at end of file diff --git a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_password_format__1.txt b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_password_format__1.txt index 1d3bbbf..be9f889 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_password_format__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_password_format__1.txt @@ -1 +1 @@ -EZW$\;&bL| \ No newline at end of file +0~|"aP0FtS \ No newline at end of file diff --git a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_patterns__1.txt b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_patterns__1.txt index 041aae3..49db9ac 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_patterns__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_patterns__1.txt @@ -1 +1 @@ -206-49-9100 \ No newline at end of file +777-38-5390 \ No newline at end of file diff --git a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_uri_format__1.txt b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_uri_format__1.txt index cc6e627..8dbd07f 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_uri_format__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_uri_format__1.txt @@ -1 +1 @@ -http://www.morar.com/harum-veniam-veritatis-cumque \ No newline at end of file +http://okon.com/placeat-qui-ut-dolores-aspernatur-ut \ No newline at end of file diff --git a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_uuid_format__1.txt b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_uuid_format__1.txt index 835b75b..639c037 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_uuid_format__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_can_handle_uuid_format__1.txt @@ -1 +1 @@ -ed362eda-e6a6-3117-a859-04184adc442b \ No newline at end of file +af12c48d-d649-34d9-a6f2-25e7f3549980 \ No newline at end of file diff --git a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_will_return_a_string_if_unknown_format_is_given__1.txt b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_will_return_a_string_if_unknown_format_is_given__1.txt index f820d12..d34ed81 100644 --- a/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_will_return_a_string_if_unknown_format_is_given__1.txt +++ b/tests/Unit/SchemaFaker/__snapshots__/StringFakerTest__it_will_return_a_string_if_unknown_format_is_given__1.txt @@ -1 +1 @@ -reprehenderit \ No newline at end of file +laboriosam \ No newline at end of file diff --git a/tests/Unit/UnitTestCase.php b/tests/Unit/UnitTestCase.php index 9f6cf61..d681492 100644 --- a/tests/Unit/UnitTestCase.php +++ b/tests/Unit/UnitTestCase.php @@ -9,8 +9,6 @@ use function mt_srand; -use const MT_RAND_PHP; - class UnitTestCase extends TestCase { use MatchesSnapshots; @@ -20,6 +18,6 @@ public function setUp(): void parent::setUp(); // Use predefined seed, so we can make realistic assertions - mt_srand((int) 9175, MT_RAND_PHP); + mt_srand(9175); } }