From fcfe1ce9d7fe5e3838e0691ff223b23b38422bef Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Fri, 21 Sep 2018 19:28:57 +0200 Subject: [PATCH] Optimized tests --- .../unit/Controller/DefaultControllerTest.php | 2 +- .../unit/Controller/UserControllerTest.php | 44 ------------------- application/tests/unit/Entity/UserTest.php | 26 +++++++++-- 3 files changed, 24 insertions(+), 48 deletions(-) delete mode 100644 application/tests/unit/Controller/UserControllerTest.php diff --git a/application/tests/unit/Controller/DefaultControllerTest.php b/application/tests/unit/Controller/DefaultControllerTest.php index 47af3a1..f863382 100644 --- a/application/tests/unit/Controller/DefaultControllerTest.php +++ b/application/tests/unit/Controller/DefaultControllerTest.php @@ -12,7 +12,7 @@ use App\Controller\DefaultController; class DefaultControllerTest extends WebTestCase { /** - * @var DefaultControllerInterface + * @var DefaultController */ protected $defaultController; diff --git a/application/tests/unit/Controller/UserControllerTest.php b/application/tests/unit/Controller/UserControllerTest.php deleted file mode 100644 index 71895c2..0000000 --- a/application/tests/unit/Controller/UserControllerTest.php +++ /dev/null @@ -1,44 +0,0 @@ -userController = new UserController(); - } - - public function testLogout(): void - { - $client = static::createClient(); - $client->request('GET', '/user/logout'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - } - - public function testLogin(): void - { - $client = static::createClient(); - $client->request('GET', '/login'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - } - - public function testRegister(): void - { - $client = static::createClient(); - $client->request('GET', '/user/register'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); - } -} diff --git a/application/tests/unit/Entity/UserTest.php b/application/tests/unit/Entity/UserTest.php index 7881e16..81944cb 100644 --- a/application/tests/unit/Entity/UserTest.php +++ b/application/tests/unit/Entity/UserTest.php @@ -1,20 +1,25 @@ user = new User(); - $this->user->setPassword(self::PASSWORD); - $this->user->setUsername(' '.self::USERNAME.' '); } public function testUsername(): void { + $this->user->setUsername(self::USERNAME); $this->assertEquals(self::USERNAME, $this->user->getUsername()); } public function testPassword(): void { + $this->user->setPassword(self::PASSWORD); $this->assertEquals(self::PASSWORD, $this->user->getPassword()); } + + public function testSource(): void + { + $this->assertInstanceOf(UserSource::class,$this->user->getSource()); + } + + public function testNode(): void + { + $this->assertInstanceOf(Node::class,$this->user->getSource()->getNode()); + } + + public function testLaw(): void + { + $this->assertInstanceOf(Law::class,$this->user->getSource()->getNode()->getLaw()); + } }