From a470e4008a569b739dd43ee605745814a2f3adcb Mon Sep 17 00:00:00 2001 From: simba77 Date: Thu, 27 Jun 2024 14:07:29 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=D0=BD=20=D1=82=D0=B5=D1=81=D1=82=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D0=B4=D0=BE=D1=81=D1=82=D1=83?= =?UTF-8?q?=D0=BF=D0=B0=20=D0=BA=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=86=D0=B0=D0=BC=20=D0=B4=D0=BB=D1=8F=20=D1=83=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=8E=D0=B7=D0=B5?= =?UTF-8?q?=D1=80=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Feature/Users/AdminUsersTest.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/Feature/Users/AdminUsersTest.php b/tests/Feature/Users/AdminUsersTest.php index 6fee37d..d1eef7a 100644 --- a/tests/Feature/Users/AdminUsersTest.php +++ b/tests/Feature/Users/AdminUsersTest.php @@ -6,16 +6,29 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Modules\Users\Models\User; +use PHPUnit\Framework\Attributes\TestWith; use Tests\TestCase; class AdminUsersTest extends TestCase { use RefreshDatabase; - public function testAccessToPages(): void + #[TestWith(['admin.users.index'], 'index')] + #[TestWith(['admin.users.list-filters'], 'list-filters')] + #[TestWith(['admin.users.create', 'POST'], 'create')] + #[TestWith(['admin.users.update', 'POST'], 'update')] + #[TestWith(['admin.users.edit-user-form', 'GET', ['id' => 1]], 'edit-user-form')] + #[TestWith(['admin.users.get-form-params'], 'get-form-params')] + #[TestWith(['admin.users.delete', 'POST', ['id' => 1]], 'delete')] + public function testAccessToPages(string $routeName, string $method = 'GET', array $params = []): void { - $response = $this->get(route('admin.users.index')); - $response->assertRedirect('/'); + if ($method === 'GET') { + $response = $this->get(route($routeName, $params)); + $response->assertRedirect('/'); + } elseif ($method === 'POST') { + $response = $this->post(route($routeName, $params)); + $response->assertRedirect('/'); + } } public function testIndexPage(): void