From 917bc110e3db688934e70732ea1aa18a5b527a4e Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Thu, 6 Sep 2018 15:22:51 +0200 Subject: [PATCH] Implemented tests for user --- .../src/Entity/Attribut/UsernameAttribut.php | 2 +- application/src/Entity/User.php | 5 --- application/tests/unit/Entity/UserTest.php | 38 +++++++++++++++++++ 3 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 application/tests/unit/Entity/UserTest.php diff --git a/application/src/Entity/Attribut/UsernameAttribut.php b/application/src/Entity/Attribut/UsernameAttribut.php index 73ac756..3ca3064 100644 --- a/application/src/Entity/Attribut/UsernameAttribut.php +++ b/application/src/Entity/Attribut/UsernameAttribut.php @@ -18,7 +18,7 @@ trait UsernameAttribut{ return $this->username; } - public function setUsernames(string $username):void{ + public function setUsername(string $username):void{ $this->username = $username; } } diff --git a/application/src/Entity/User.php b/application/src/Entity/User.php index 8497b8b..5a11b0a 100644 --- a/application/src/Entity/User.php +++ b/application/src/Entity/User.php @@ -15,11 +15,6 @@ class User extends AbstractSource implements UserInterface { use UsernameAttribut,PasswordAttribut; - /** - * @ORM\Column(type="string", length=254, unique=true) - */ - private $email; - /** * @ORM\Column(name="is_active", type="boolean") */ diff --git a/application/tests/unit/Entity/UserTest.php b/application/tests/unit/Entity/UserTest.php new file mode 100644 index 0000000..5af36e4 --- /dev/null +++ b/application/tests/unit/Entity/UserTest.php @@ -0,0 +1,38 @@ +user = new User(); + $this->user->setPassword(self::PASSWORD); + $this->user->setUsername(self::USERNAME); + } + + public function testUsername():void{ + $this->assertEquals(self::USERNAME,$this->user->getUsername()); + } + + public function testPassword():void{ + $this->assertEquals(self::PASSWORD,$this->user->getPassword()); + } +} +