Skip to content

Commit d3ac27f

Browse files
committed
refactor factories
1 parent 0974fb4 commit d3ac27f

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

tests/database/factories/CustomerFactory.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,14 @@
99

1010
class CustomerFactory extends Factory
1111
{
12-
/**
13-
* The name of the factory's corresponding model.
14-
*
15-
* @var string
16-
*/
1712
protected $model = Customer::class;
1813

19-
/**
20-
* Define the model's default state.
21-
*/
2214
public function definition(): array
2315
{
2416
return [
25-
'name' => $this->faker->name(),
26-
'email' => $this->faker->unique()->safeEmail(),
27-
'type' => $this->faker->randomElement(['small', 'medium', 'big']),
17+
'name' => fake()->name(),
18+
'email' => fake()->unique()->safeEmail(),
19+
'type' => fake()->randomElement(['small', 'medium', 'big']),
2820
];
2921
}
3022
}

tests/database/factories/ProductFactory.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,12 @@
99

1010
class ProductFactory extends Factory
1111
{
12-
/**
13-
* The name of the factory's corresponding model.
14-
*
15-
* @var string
16-
*/
1712
protected $model = Product::class;
1813

19-
/**
20-
* Define the model's default state.
21-
*/
2214
public function definition(): array
2315
{
2416
return [
25-
'name' => $this->faker->words(3, true),
17+
'name' => fake()->words(3, true),
2618
];
2719
}
2820
}

0 commit comments

Comments
 (0)