Skip to content

Commit

Permalink
Fix Faker deprecations (closes #467)
Browse files Browse the repository at this point in the history
  • Loading branch information
shalvah committed May 14, 2022
1 parent 6950f4b commit 8093961
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Extracting/ParamHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function getDummyValueGenerator(string $type, int $size = null): \Clos
'integer' => fn() => $size ?: $faker->numberBetween(1, 20),
'number' => fn() => $size ?: $faker->randomFloat(),
'boolean' => fn() => $faker->boolean(),
'string' => fn() => $size ? $faker->lexify(str_repeat("?", $size)) : $faker->word,
'string' => fn() => $size ? $faker->lexify(str_repeat("?", $size)) : $faker->word(),
'object' => fn() => [],
'file' => fn() => UploadedFile::fake()->create('test.jpg')->size($size ?: 10),
];
Expand Down
2 changes: 1 addition & 1 deletion src/Writing/PostmanCollectionWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ protected function generateUrlObject(OutputEndpointData $endpointData): array
} else {
$query[] = [
'key' => urlencode($name),
'value' => urlencode($parameterData->example),
'value' => $parameterData->example != null ? urlencode($parameterData->example) : '',
'description' => strip_tags($parameterData->description),
// Default query params to disabled if they aren't required and have empty values
'disabled' => !$parameterData->required && empty($parameterData->example),
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/OpenAPISpecWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,17 +509,17 @@ public function adds_responses_correctly_as_responses_on_operation_object()
protected function createMockEndpointData(array $custom = []): OutputEndpointData
{
$faker = Factory::create();
$path = '/' . $faker->word;
$path = '/' . $faker->word();
$data = [
'uri' => $path,
'httpMethods' => $faker->randomElements(['GET', 'POST', 'PUT', 'PATCH', 'DELETE'], 1),
'headers' => [
'Content-Type' => 'application/json',
],
'metadata' => [
'title' => $faker->sentence,
'description' => $faker->randomElement([$faker->sentence, '']),
'authenticated' => $faker->boolean,
'title' => $faker->sentence(),
'description' => $faker->randomElement([$faker->sentence(), '']),
'authenticated' => $faker->boolean(),
],
'urlParameters' => [], // Should be set by caller (along with custom path)
'queryParameters' => [],
Expand Down

0 comments on commit 8093961

Please sign in to comment.