Implemented tests for user

This commit is contained in:
Kevin Frantz 2018-09-06 15:22:51 +02:00
parent a857f515d3
commit 917bc110e3
3 changed files with 39 additions and 6 deletions

View File

@ -18,7 +18,7 @@ trait UsernameAttribut{
return $this->username;
}
public function setUsernames(string $username):void{
public function setUsername(string $username):void{
$this->username = $username;
}
}

View File

@ -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")
*/

View File

@ -0,0 +1,38 @@
<?php
namespace tests\unit\Entity;
use PHPUnit\Framework\TestCase;
use App\Entity\User;
/**
*
* @author kevinfrantz
*
*/
class UserTest extends TestCase
{
const PASSWORD = '12345678';
const USERNAME = 'tester';
/**
*
* @var User
*/
protected $user;
public function setUp():void{
$this->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());
}
}