Skip to content

Commit 51cd1c6

Browse files
committed
Test for unconventional relationship name
1 parent 3937066 commit 51cd1c6

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

tests/Feature/Generator/FactoryGeneratorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ public function output_writes_migration_for_model_tree($definition, $path, $migr
6464
public function modelTreeDataProvider()
6565
{
6666
return [
67-
['definitions/post.bp', 'database/factories/PostFactory.php', 'factories/post.php']
67+
['definitions/post.bp', 'database/factories/PostFactory.php', 'factories/post.php'],
68+
['definitions/team.bp', 'database/factories/TeamFactory.php', 'factories/team.php']
6869
];
6970
}
7071
}

tests/fixtures/definitions/team.bp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
models:
2+
Team:
3+
name: string
4+
owner_id: id:user

tests/fixtures/factories/team.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
/** @var \Illuminate\Database\Eloquent\Factory $factory */
4+
5+
use App\Team;
6+
use Faker\Generator as Faker;
7+
8+
$factory->define(Team::class, function (Faker $faker) {
9+
return [
10+
'name' => $faker->name,
11+
'owner_id' => factory(\App\User::class),
12+
];
13+
});

0 commit comments

Comments
 (0)