diff --git a/database/Factories/FoodFactory.php b/database/Factories/FoodFactory.php index 6d7bb88..2ffd365 100644 --- a/database/Factories/FoodFactory.php +++ b/database/Factories/FoodFactory.php @@ -39,55 +39,4 @@ class FoodFactory extends Factory ]; } - /** - * Define a "tsp" serving unit. - */ - public function tspServingUnit() - { - return $this->state(function (array $attributes) { - return [ - 'serving_unit' => 'tsp', - 'serving_size' => 1, - ]; - }); - } - - /** - * Define a "tbsp" serving unit. - */ - public function tbspServingUnit() - { - return $this->state(function (array $attributes) { - return [ - 'serving_unit' => 'tbsp', - 'serving_size' => 1, - ]; - }); - } - - /** - * Define a "cup" serving unit. - */ - public function cupServingUnit() - { - return $this->state(function (array $attributes) { - return [ - 'serving_unit' => 'cup', - 'serving_size' => 1, - ]; - }); - } - - /** - * Define no serving unit. - */ - public function noServingUnit() - { - return $this->state(function (array $attributes) { - return [ - 'serving_unit' => null, - 'serving_unit_name' => 'head' - ]; - }); - } } diff --git a/tests/Feature/Support/NutrientsTest.php b/tests/Feature/Support/NutrientsTest.php index ab5d285..ff3b0ee 100644 --- a/tests/Feature/Support/NutrientsTest.php +++ b/tests/Feature/Support/NutrientsTest.php @@ -116,7 +116,7 @@ class NutrientsTest extends TestCase [$foodInvalidUnit, 1, 'tsp'], [$foodInvalidUnit, 1, 'tbsp'], [$foodInvalidUnit, 1, 'cup'], - [Food::factory()->tspServingUnit()->make(), 1, 'invalid'], + [Food::factory()->make(['serving_unit' => 'tsp', 'serving_size' => 1]), 1, 'invalid'], ]; } @@ -128,10 +128,10 @@ class NutrientsTest extends TestCase /** @var \App\Models\Food[] $foods */ $foods = [ - 'tsp' => Food::factory()->tspServingUnit()->make(), - 'tbsp' => Food::factory()->tbspServingUnit()->make(), - 'cup' => Food::factory()->cupServingUnit()->make(), - 'none' => Food::factory()->noServingUnit()->make(), + 'tsp' => Food::factory()->make(['serving_unit' => 'tsp', 'serving_size' => 1]), + 'tbsp' => Food::factory()->make(['serving_unit' => 'tbsp', 'serving_size' => 1]), + 'cup' => Food::factory()->make(['serving_unit' => 'cup', 'serving_size' => 1]), + 'none' => Food::factory()->make(['serving_unit' => null, 'serving_unit_name' => 'head']), ]; return [