infinito/application/symfony/tests/Unit/Entity/UserTest.php

54 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2018-09-06 15:22:51 +02:00
<?php
2018-09-21 19:43:48 +02:00
2018-09-06 15:22:51 +02:00
namespace tests\unit\Entity;
use Infinito\Entity\Source\Complex\UserSource;
2020-04-02 21:13:35 +02:00
use Infinito\Entity\User;
use Infinito\Entity\UserInterface;
2020-04-02 21:13:35 +02:00
use PHPUnit\Framework\TestCase;
2018-09-06 15:22:51 +02:00
/**
* @author kevinfrantz
use Infinito\Entity\Source\UserSource;
2018-09-06 15:22:51 +02:00
*/
class UserTest extends TestCase
{
const PASSWORD = '12345678';
2018-09-12 22:25:22 +02:00
2018-09-06 15:22:51 +02:00
const USERNAME = 'tester';
2018-09-12 22:25:22 +02:00
2018-09-06 15:22:51 +02:00
/**
* @var UserInterface
2018-09-06 15:22:51 +02:00
*/
protected $user;
2018-09-12 22:25:22 +02:00
public function setUp(): void
{
2018-09-06 15:22:51 +02:00
$this->user = new User();
$this->user->setUsername(self::USERNAME);
$this->user->setPassword(self::PASSWORD);
2018-09-06 15:22:51 +02:00
}
2018-10-29 19:01:00 +01:00
public function testConstructor(): void
{
$this->assertInstanceOf(UserInterface::class, new User());
$this->assertEquals(0, $this->user->getVersion());
}
2018-09-12 22:25:22 +02:00
public function testUsername(): void
{
$this->assertEquals(self::USERNAME, $this->user->getUsername());
2018-09-06 15:22:51 +02:00
}
2018-09-12 22:25:22 +02:00
public function testPassword(): void
{
$this->assertEquals(self::PASSWORD, $this->user->getPassword());
2018-09-06 15:22:51 +02:00
}
2018-09-21 19:43:48 +02:00
2018-09-21 19:28:57 +02:00
public function testSource(): void
{
2018-09-21 19:43:48 +02:00
$this->assertInstanceOf(UserSource::class, $this->user->getSource());
2018-11-04 12:40:57 +01:00
$this->assertEquals($this->user, $this->user->getSource()->getUser());
2018-09-21 19:28:57 +02:00
}
2018-09-06 15:22:51 +02:00
}