Files
eatvio-infra/tests/Feature/Product_Nutritional/ShowTest.php

48 lines
1.1 KiB
PHP

<?php
namespace Tests\Feature\Product_Nutritional;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
use App\Models\ProductNutritionalValue;
class ShowTest extends TestCase
{
use RefreshDatabase;
private ProductNutritionalValue $product;
protected User $user;
public function setUp(): void
{
$this->refreshApplicationWithLocale('en');
$this->user = User::factory()->create(['is_consultant' => true]);
$this->product = ProductNutritionalValue::inRandomOrder()->first();
}
public function test_show_page_success(): void
{
$response = $this->actingAs($this->user)
->get(route('product_nutritional_value.show', $this->product));
$response
->assertOk();
}
// When appear role for user
// public function test_show_form_is_not_consultant()
// {
// $user = User::factory()->create(['is_consultant' => false]);
// $response = $this->actingAs($this->user)
// ->get('/plan/'. $this->plan->id);
// $response
// ->assertStatus(403);
// }
}