-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from stlgaits/main
retrofit
- Loading branch information
Showing
11 changed files
with
319 additions
and
175 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,19 @@ | |
namespace App\Tests\Controller; | ||
|
||
use App\Test\CustomTestCase; | ||
use http\Client\Curl\User; | ||
|
||
/** | ||
* @group security | ||
* @covers App\Controller\UserController | ||
* @uses \App\Entity\User | ||
* @uses \App\Security\Voter\TaskVoter | ||
*/ | ||
final class UserControllerTest extends CustomTestCase | ||
{ | ||
/** | ||
* @covers \App\Controller\UserController::list | ||
*/ | ||
public function testOnlyAdminUsersCanAccessUsersListPage(): void | ||
{ | ||
$client = $this->createClient(); | ||
|
@@ -20,6 +27,9 @@ public function testOnlyAdminUsersCanAccessUsersListPage(): void | |
$this->assertResponseIsSuccessful(); | ||
} | ||
|
||
/** | ||
* @covers \App\Controller\UserController::list | ||
*/ | ||
public function testAnonymousUserCannotAccessUsersListPage(): void | ||
{ | ||
$client = $this->createClient(); | ||
|
@@ -28,6 +38,9 @@ public function testAnonymousUserCannotAccessUsersListPage(): void | |
$this->assertResponseStatusCodeSame(302); | ||
} | ||
|
||
/** | ||
* @covers \App\Controller\UserController::list | ||
*/ | ||
public function testNonAdminUserCannotAccessUsersListPage(): void | ||
{ | ||
$client = $this->createClient(); | ||
|
@@ -37,10 +50,14 @@ public function testNonAdminUserCannotAccessUsersListPage(): void | |
$this->assertResponseStatusCodeSame(403); | ||
} | ||
|
||
/** | ||
* @covers \App\Controller\UserController::create | ||
*/ | ||
public function testAdminUserCanCreateNewUser(): void | ||
{ | ||
$client = $this->createClient(); | ||
$user = $this->createAdminUser("IamAdmin", "mysupersecureadminpwd", "[email protected]"); | ||
$userRepository = $this->getEntityManager()->getRepository(User::class); | ||
$user = $userRepository->findOneBy(['username' => 'admin']); | ||
$client->loginUser($user); | ||
$client->request('GET', '/users/create'); | ||
$this->markTestIncomplete(); | ||
|
@@ -51,26 +68,41 @@ public function testAdminUserCanCreateNewUser(): void | |
$this->assertResponseIsSuccessful(); | ||
} | ||
|
||
/** | ||
* @covers \App\Controller\UserController::create | ||
*/ | ||
public function testNonAdminUserCannotCreateNewUser(): void | ||
{ | ||
$this->markTestIncomplete(); | ||
} | ||
|
||
/** | ||
* @covers \App\Controller\UserController::edit | ||
*/ | ||
public function testAdminUserCanEditAnotherUser(): void | ||
{ | ||
$this->markTestIncomplete(); | ||
} | ||
|
||
/** | ||
* @covers \App\Controller\UserController::edit | ||
*/ | ||
public function testAdminUserCanPromoteAnotherUser(): void | ||
{ | ||
$this->markTestIncomplete(); | ||
} | ||
|
||
/** | ||
* @covers \App\Controller\UserController::edit | ||
*/ | ||
public function testAdminUserCanDemoteAnotherUser(): void | ||
{ | ||
$this->markTestIncomplete(); | ||
} | ||
|
||
/** | ||
* @covers \App\Controller\UserController::edit | ||
*/ | ||
public function testNonAdminUserCannotEditAnotherUser(): void | ||
{ | ||
$this->markTestIncomplete(); | ||
|
Oops, something went wrong.