Complete TP7 TP8 authentication authorization and classic CSS
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Tests\Feature;
|
||||
|
||||
use App\Models\Client;
|
||||
use App\Models\Product;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -13,6 +14,8 @@ class Tp6SearchPaginationTest extends TestCase
|
||||
|
||||
public function test_client_search_checks_name_email_and_city(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->create());
|
||||
|
||||
Client::create(['name' => 'Jean Dupont', 'email' => 'jean@example.test', 'city' => 'Paris']);
|
||||
Client::create(['name' => 'Marie Martin', 'email' => 'marie@gmail.test', 'city' => 'Lyon']);
|
||||
Client::create(['name' => 'Paul Durand', 'email' => 'paul@example.test', 'city' => 'Bordeaux']);
|
||||
@@ -29,6 +32,8 @@ class Tp6SearchPaginationTest extends TestCase
|
||||
|
||||
public function test_client_pagination_keeps_the_search_on_page_two(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->create());
|
||||
|
||||
for ($number = 1; $number <= 12; $number++) {
|
||||
Client::create([
|
||||
'name' => sprintf('Jean %02d', $number),
|
||||
@@ -51,6 +56,8 @@ class Tp6SearchPaginationTest extends TestCase
|
||||
|
||||
public function test_product_search_by_name_or_price_is_paginated(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->create());
|
||||
|
||||
for ($number = 1; $number <= 12; $number++) {
|
||||
Product::create(['name' => sprintf('Clavier %02d', $number), 'price' => 50, 'stock' => 10]);
|
||||
}
|
||||
@@ -70,6 +77,8 @@ class Tp6SearchPaginationTest extends TestCase
|
||||
|
||||
public function test_form_requests_keep_tp5_validation_and_messages(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->create());
|
||||
|
||||
$this->post(route('clients.store'), ['name' => '', 'email' => 'bonjour'])
|
||||
->assertSessionHasErrors(['name', 'email']);
|
||||
$this->post(route('products.store'), ['name' => 'Clavier', 'price' => -2, 'stock' => 1])
|
||||
|
||||
Reference in New Issue
Block a user