infinito/application/tests/unit/Entity/UserTest.php

58 lines
1.2 KiB
PHP
Raw 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 PHPUnit\Framework\TestCase;
use App\Entity\User;
2018-10-28 15:25:32 +01:00
use App\Entity\Meta\Law;
use App\Entity\Meta\Relation;
2018-10-03 16:14:15 +02:00
use App\Entity\Source\UserSource;
2018-09-06 15:22:51 +02:00
/**
* @author kevinfrantz
2018-10-28 15:25:32 +01:00
use App\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 User
*/
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();
}
2018-09-12 22:25:22 +02:00
public function testUsername(): void
{
2018-09-21 19:28:57 +02:00
$this->user->setUsername(self::USERNAME);
2018-09-12 22:25:22 +02:00
$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
{
2018-09-21 19:28:57 +02:00
$this->user->setPassword(self::PASSWORD);
2018-09-12 22:25:22 +02:00
$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-09-21 19:28:57 +02:00
}
2018-09-21 19:43:48 +02:00
2018-09-21 19:28:57 +02:00
public function testNode(): void
{
2018-10-28 15:25:32 +01:00
$this->assertInstanceOf(Relation::class, $this->user->getSource()->getNode());
2018-09-21 19:28:57 +02:00
}
public function testLaw(): void
{
2018-09-21 19:43:48 +02:00
$this->assertInstanceOf(Law::class, $this->user->getSource()->getNode()->getLaw());
2018-09-21 19:28:57 +02:00
}
2018-09-06 15:22:51 +02:00
}