From 02cbbd224b0accb5ba79a1b1cc72db608eb0f327 Mon Sep 17 00:00:00 2001 From: Jason McCreary Date: Wed, 4 Mar 2020 15:26:30 -0500 Subject: [PATCH] fix: mismatched key casing (#70) --- src/Generators/FactoryGenerator.php | 2 +- tests/fixtures/definitions/post.bp | 1 + tests/fixtures/factories/post-configured.php | 1 + tests/fixtures/factories/post.php | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Generators/FactoryGenerator.php b/src/Generators/FactoryGenerator.php index c3167b9d..3060ddf5 100644 --- a/src/Generators/FactoryGenerator.php +++ b/src/Generators/FactoryGenerator.php @@ -173,6 +173,6 @@ public static function fakerDataType(string $type) 'enum' => 'randomElement(/** enum_attributes **/)', ]; - return $fakeableTypes[$type] ?? null; + return $fakeableTypes[strtolower($type)] ?? null; } } diff --git a/tests/fixtures/definitions/post.bp b/tests/fixtures/definitions/post.bp index 8dd49577..b6fb45ec 100644 --- a/tests/fixtures/definitions/post.bp +++ b/tests/fixtures/definitions/post.bp @@ -2,6 +2,7 @@ models: Post: title: string author_id: id + author_bio: longtext content: bigtext nullable published_at: timestamp nullable word_count: integer unsigned \ No newline at end of file diff --git a/tests/fixtures/factories/post-configured.php b/tests/fixtures/factories/post-configured.php index aca8a155..2215210f 100644 --- a/tests/fixtures/factories/post-configured.php +++ b/tests/fixtures/factories/post-configured.php @@ -9,6 +9,7 @@ return [ 'title' => $faker->sentence(4), 'author_id' => factory(\Some\App\Models\Author::class), + 'author_bio' => $faker->text, 'content' => $faker->paragraphs(3, true), 'published_at' => $faker->dateTime(), 'word_count' => $faker->randomNumber(), diff --git a/tests/fixtures/factories/post.php b/tests/fixtures/factories/post.php index 9418cfd0..ee9e8bc7 100644 --- a/tests/fixtures/factories/post.php +++ b/tests/fixtures/factories/post.php @@ -9,6 +9,7 @@ return [ 'title' => $faker->sentence(4), 'author_id' => factory(\App\Author::class), + 'author_bio' => $faker->text, 'content' => $faker->paragraphs(3, true), 'published_at' => $faker->dateTime(), 'word_count' => $faker->randomNumber(),