mirror of https://github.com/kcal-app/kcal.git
Test Food create GET request
This commit is contained in:
parent
9878c42e86
commit
058d8878fb
|
|
@ -19,9 +19,14 @@ class FoodTest extends LoggedInTestCase
|
||||||
|
|
||||||
public function testCanAddFood()
|
public function testCanAddFood()
|
||||||
{
|
{
|
||||||
|
$create_url = action([FoodController::class, 'create']);
|
||||||
|
$response = $this->get($create_url);
|
||||||
|
$response->assertOk();
|
||||||
|
|
||||||
/** @var \App\Models\Food $food */
|
/** @var \App\Models\Food $food */
|
||||||
$food = Food::factory()->make();
|
$food = Food::factory()->make();
|
||||||
$response = $this->followingRedirects()->post('/foods', $food->toArray());
|
$store_url = action([FoodController::class, 'store']);
|
||||||
|
$response = $this->followingRedirects()->post($store_url, $food->toArray());
|
||||||
$response->assertOk();
|
$response->assertOk();
|
||||||
$response->assertSee("Food {$food->name} updated!");
|
$response->assertSee("Food {$food->name} updated!");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue