Skip to content

Commit

Permalink
Feature\Group('auth-page')
Browse files Browse the repository at this point in the history
  • Loading branch information
realodix committed May 17, 2024
1 parent 3161459 commit ca4cef0
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 34 deletions.
4 changes: 1 addition & 3 deletions tests/Feature/AuthPage/AboutPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

namespace Tests\Feature\AuthPage;

use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

#[\PHPUnit\Framework\Attributes\Group('auth-page')]
class AboutPageTest extends TestCase
{
#[Test]
#[Group('f-about')]
public function auAdminCanAccessThisPage(): void
{
$response = $this->actingAs($this->adminUser())
Expand All @@ -19,7 +18,6 @@ public function auAdminCanAccessThisPage(): void
}

#[Test]
#[Group('f-about')]
public function auNormalUserCantAccessThisPage(): void
{
$response = $this->actingAs($this->normalUser())
Expand Down
9 changes: 2 additions & 7 deletions tests/Feature/AuthPage/AllUrlsPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
namespace Tests\Feature\AuthPage;

use App\Models\Url;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

#[\PHPUnit\Framework\Attributes\Group('auth-page')]
#[\PHPUnit\Framework\Attributes\Group('link-page')]
class AllUrlsPageTest extends TestCase
{
#[Test]
#[Group('f-allurl')]
public function auAdminCanAccessThisPage(): void
{
$response = $this->actingAs($this->adminUser())
Expand All @@ -19,7 +19,6 @@ public function auAdminCanAccessThisPage(): void
}

#[Test]
#[Group('f-allurl')]
public function auNormalUserCantAccessThisPage(): void
{
$response = $this->actingAs($this->normalUser())
Expand All @@ -30,7 +29,6 @@ public function auNormalUserCantAccessThisPage(): void
/**
* Admin can access user links and guest links table page
*/
#[Group('f-allurl')]
public function testAdminCanAccessUserLinksTablePage(): void
{
$user = $this->adminUser();
Expand All @@ -47,7 +45,6 @@ public function testAdminCanAccessUserLinksTablePage(): void
/**
* Non admin users can't access user links and guest links table page
*/
#[Group('f-allurl')]
public function testNonAdminUsersCantAccessUserLinksTablePage(): void
{
$user = $this->normalUser();
Expand All @@ -62,7 +59,6 @@ public function testNonAdminUsersCantAccessUserLinksTablePage(): void
}

#[Test]
#[Group('f-allurl')]
public function auAdminCanDelete(): void
{
$url = Url::factory()->create();
Expand All @@ -78,7 +74,6 @@ public function auAdminCanDelete(): void
}

#[Test]
#[Group('f-allurl')]
public function auNormalUserCantDelete(): void
{
$url = Url::factory()->create();
Expand Down
7 changes: 2 additions & 5 deletions tests/Feature/AuthPage/DashboardPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
namespace Tests\Feature\AuthPage;

use App\Models\Url;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

#[\PHPUnit\Framework\Attributes\Group('auth-page')]
#[\PHPUnit\Framework\Attributes\Group('link-page')]
class DashboardPageTest extends TestCase
{
#[Test]
#[Group('f-dashboard')]
public function dCanAccessPage(): void
{
$response = $this->actingAs($this->normalUser())
Expand All @@ -20,7 +20,6 @@ public function dCanAccessPage(): void
}

#[Test]
#[Group('f-dashboard')]
public function dCanDelete(): void
{
$url = Url::factory()->create();
Expand All @@ -37,7 +36,6 @@ public function dCanDelete(): void
}

#[Test]
#[Group('f-dashboard')]
public function dAuthorizedUserCanAccessEditUrlPage(): void
{
$url = Url::factory()->create();
Expand All @@ -49,7 +47,6 @@ public function dAuthorizedUserCanAccessEditUrlPage(): void
}

#[Test]
#[Group('f-dashboard')]
public function dCanUpdateUrl(): void
{
$url = Url::factory()->create();
Expand Down
12 changes: 2 additions & 10 deletions tests/Feature/AuthPage/User/AccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
namespace Tests\Feature\AuthPage\User;

use App\Models\User;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

#[\PHPUnit\Framework\Attributes\Group('auth-page')]
#[\PHPUnit\Framework\Attributes\Group('user-page')]
class AccountTest extends TestCase
{
protected function getRoute(mixed $value): string
Expand All @@ -19,7 +20,6 @@ protected function postRoute(mixed $value): string
return route('user.update', $value);
}

#[Group('f-user')]
public function testUsersCanAccessTheirOwnAccountPages(): void
{
$user = $this->normalUser();
Expand All @@ -29,7 +29,6 @@ public function testUsersCanAccessTheirOwnAccountPages(): void
$response->assertOk();
}

#[Group('f-user')]
public function testAdminCanAccessEveryUserAccountPage(): void
{
$response = $this->actingAs($this->adminUser())
Expand All @@ -38,7 +37,6 @@ public function testAdminCanAccessEveryUserAccountPage(): void
$response->assertOk();
}

#[Group('f-user')]
public function testUserCannotAccessAnotherUserSAccountPage(): void
{
$response = $this->actingAs($this->normalUser())
Expand All @@ -48,7 +46,6 @@ public function testUserCannotAccessAnotherUserSAccountPage(): void
}

#[Test]
#[Group('f-user')]
public function adminCanChangeOtherUsersEmail(): void
{
$user = User::factory()->create(['email' => 'user_email@urlhub.test']);
Expand All @@ -67,7 +64,6 @@ public function adminCanChangeOtherUsersEmail(): void
}

#[Test]
#[Group('f-user')]
public function normalUserCantChangeOtherUsersEmail(): void
{
$user = User::factory()->create(['email' => 'user2@urlhub.test']);
Expand All @@ -83,7 +79,6 @@ public function normalUserCantChangeOtherUsersEmail(): void
}

#[Test]
#[Group('f-user')]
public function validationEmailRequired(): void
{
$user = $this->normalUser();
Expand All @@ -100,7 +95,6 @@ public function validationEmailRequired(): void
}

#[Test]
#[Group('f-user')]
public function validationEmailInvalidFormat(): void
{
$user = $this->normalUser();
Expand All @@ -117,7 +111,6 @@ public function validationEmailInvalidFormat(): void
}

#[Test]
#[Group('f-user')]
public function validationEmailMaxLength(): void
{
$user = $this->normalUser();
Expand All @@ -135,7 +128,6 @@ public function validationEmailMaxLength(): void
}

#[Test]
#[Group('f-user')]
public function validationEmailUnique(): void
{
$user = $this->normalUser();
Expand Down
8 changes: 2 additions & 6 deletions tests/Feature/AuthPage/User/ChangePasswordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
use App\Models\User;
use Illuminate\Support\Facades\Hash;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

#[\PHPUnit\Framework\Attributes\Group('auth-page')]
#[\PHPUnit\Framework\Attributes\Group('user-page')]
class ChangePasswordTest extends TestCase
{
protected User $user;
Expand All @@ -35,7 +36,6 @@ protected function postRoute(mixed $value): string
}

#[Test]
#[Group('f-user')]
public function changePasswordWithCorrectCredentials(): void
{
$response = $this->actingAs($this->user)
Expand All @@ -56,7 +56,6 @@ public function changePasswordWithCorrectCredentials(): void
}

#[Test]
#[Group('f-user')]
public function adminCanChangeThePasswordOfAllUsers(): void
{
$response = $this->actingAs($this->adminUser())
Expand All @@ -78,7 +77,6 @@ public function adminCanChangeThePasswordOfAllUsers(): void
}

#[Test]
#[Group('f-user')]
public function currentPasswordDoesNotMatch(): void
{
$response = $this->actingAs($this->user)
Expand All @@ -103,7 +101,6 @@ public function currentPasswordDoesNotMatch(): void
* @param mixed $data2
*/
#[Test]
#[Group('f-user')]
#[DataProvider('newPasswordFailProvider')]
public function newPasswordValidateFail($data1, $data2): void
{
Expand Down Expand Up @@ -144,7 +141,6 @@ public static function newPasswordFailProvider(): array
* The new password must be different from the current password.
*/
#[Test]
#[Group('f-user')]
#[DataProvider('newPasswordFailProvider')]
public function newPasswordmustBeDifferent(): void
{
Expand Down
5 changes: 2 additions & 3 deletions tests/Feature/AuthPage/UserListPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace Tests\Feature\AuthPage;

use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

#[\PHPUnit\Framework\Attributes\Group('auth-page')]
#[\PHPUnit\Framework\Attributes\Group('link-page')]
class UserListPageTest extends TestCase
{
#[Test]
#[Group('f-userlist')]
public function ulpAdminCanAccessThisPage(): void
{
$response = $this->actingAs($this->adminUser())
Expand All @@ -19,7 +19,6 @@ public function ulpAdminCanAccessThisPage(): void
}

#[Test]
#[Group('f-userlist')]
public function ulpNormalUserCantAccessThisPage(): void
{
$response = $this->actingAs($this->normalUser())
Expand Down

0 comments on commit ca4cef0

Please sign in to comment.