From 87fd2e121b282e70ab3ba6e730efa32541a249ce Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Wed, 5 Sep 2018 16:00:12 +0200 Subject: [PATCH] Implemented tests for UserController --- .../src/Controller/DefaultControllerTest.php | 3 ++ application/src/Controller/UserController.php | 18 +-------- .../Controller/UserControllerInterface.php | 2 +- .../src/Controller/UserControllerTest.php | 40 +++++++++++++++++++ 4 files changed, 45 insertions(+), 18 deletions(-) create mode 100644 application/src/Controller/UserControllerTest.php diff --git a/application/src/Controller/DefaultControllerTest.php b/application/src/Controller/DefaultControllerTest.php index 3e573bc..bcf13b5 100644 --- a/application/src/Controller/DefaultControllerTest.php +++ b/application/src/Controller/DefaultControllerTest.php @@ -10,6 +10,9 @@ use PHPUnit\Framework\TestCase; */ class DefaultControllerTest extends TestCase { + /** + * @var DefaultControllerInterface + */ protected $defaultController; public function setUp():void{ diff --git a/application/src/Controller/UserController.php b/application/src/Controller/UserController.php index 7e2f54a..566a91f 100644 --- a/application/src/Controller/UserController.php +++ b/application/src/Controller/UserController.php @@ -10,29 +10,13 @@ use Symfony\Component\HttpFoundation\Response; */ class UserController implements UserControllerInterface { - public function modify(int $id): Response - {} - public function logout(): Response {} - public function activate(): Response - {} - - public function create(): Response - {} - public function login(): Response {} - public function delete(): Response - {} - public function register(): Response {} - public function deactivate(): Response - {} - -} - +} \ No newline at end of file diff --git a/application/src/Controller/UserControllerInterface.php b/application/src/Controller/UserControllerInterface.php index 09f0bb9..0640c32 100644 --- a/application/src/Controller/UserControllerInterface.php +++ b/application/src/Controller/UserControllerInterface.php @@ -8,7 +8,7 @@ use Symfony\Component\HttpFoundation\Response; * @author kevinfrantz * */ -interface UserControllerInterface extends CreationInterface, ActivationInterface,ModificationInterface +interface UserControllerInterface { public function logout():Response; diff --git a/application/src/Controller/UserControllerTest.php b/application/src/Controller/UserControllerTest.php new file mode 100644 index 0000000..dcc5cd8 --- /dev/null +++ b/application/src/Controller/UserControllerTest.php @@ -0,0 +1,40 @@ +userController = new UserController(); + } + + public function testLogout(): void + { + $this->assertEquals(true, $this->userController->logout()->isSuccessful()); + } + + public function testLogin(): void + { + $this->assertEquals(true, $this->userController->login()->isSuccessful()); + } + + public function testRegister():void + { + $this->assertEquals(true, $this->userController->register()->isSuccessful()); + } +} +