Implemented tests for UserController

This commit is contained in:
Kevin Frantz 2018-09-05 16:00:12 +02:00
parent fc3f7f3898
commit 87fd2e121b
4 changed files with 45 additions and 18 deletions

View File

@ -10,6 +10,9 @@ use PHPUnit\Framework\TestCase;
*/ */
class DefaultControllerTest extends TestCase class DefaultControllerTest extends TestCase
{ {
/**
* @var DefaultControllerInterface
*/
protected $defaultController; protected $defaultController;
public function setUp():void{ public function setUp():void{

View File

@ -10,29 +10,13 @@ use Symfony\Component\HttpFoundation\Response;
*/ */
class UserController implements UserControllerInterface class UserController implements UserControllerInterface
{ {
public function modify(int $id): Response
{}
public function logout(): Response public function logout(): Response
{} {}
public function activate(): Response
{}
public function create(): Response
{}
public function login(): Response public function login(): Response
{} {}
public function delete(): Response
{}
public function register(): Response public function register(): Response
{} {}
public function deactivate(): Response }
{}
}

View File

@ -8,7 +8,7 @@ use Symfony\Component\HttpFoundation\Response;
* @author kevinfrantz * @author kevinfrantz
* *
*/ */
interface UserControllerInterface extends CreationInterface, ActivationInterface,ModificationInterface interface UserControllerInterface
{ {
public function logout():Response; public function logout():Response;

View File

@ -0,0 +1,40 @@
<?php
namespace Controller;
use PHPUnit\Framework\TestCase;
use App\Controller\UserController;
use App\Controller\UserControllerInterface;
/**
*
* @author kevinfrantz
*
*/
class UserControllerTest extends TestCase
{
/**
*
* @var UserControllerInterface
*/
protected $userController;
public function setUp():void{
$this->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());
}
}