mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
In between commit refactoring and implementing tests
This commit is contained in:
44
application/tests/unit/Entity/Source/AbstractSourceTest.php
Normal file
44
application/tests/unit/Entity/Source/AbstractSourceTest.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace tests\unit\Entity\Source;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Entity\Source\SourceInterface;
|
||||
use App\Entity\Meta\LawInterface;
|
||||
use App\Entity\Meta\RelationInterface;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
class AbstractSourceTest extends TestCase
|
||||
{
|
||||
const ID = 123;
|
||||
/**
|
||||
* @var SourceInterface
|
||||
*/
|
||||
protected $source;
|
||||
|
||||
public function setUp(){
|
||||
$this->source = new class extends \App\Entity\Source\AbstractSource{};
|
||||
$this->source->setId(self::ID);
|
||||
}
|
||||
|
||||
public function testId(){
|
||||
$this->assertEquals($this->source->getId(),self::ID);
|
||||
}
|
||||
|
||||
public function testLaw(){
|
||||
$this->assertInstanceOf(LawInterface::class,$this->source->getLaw());
|
||||
}
|
||||
|
||||
public function testRelation(){
|
||||
$this->assertInstanceOf(RelationInterface::class,$this->source->getRelation());
|
||||
}
|
||||
|
||||
public function testGroups(){
|
||||
$this->assertInstanceOf(Collection::class,$this->source->getGroupSources());
|
||||
}
|
||||
}
|
||||
|
@@ -4,9 +4,8 @@ namespace tests\unit\Entity;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Entity\User;
|
||||
use App\Entity\Meta\Law;
|
||||
use App\Entity\Meta\Relation;
|
||||
use App\Entity\Source\UserSource;
|
||||
use App\Entity\UserInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -19,24 +18,25 @@ class UserTest extends TestCase
|
||||
const USERNAME = 'tester';
|
||||
|
||||
/**
|
||||
* @var User
|
||||
* @var UserInterface
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->user = new User();
|
||||
$this->user->setUsername(self::USERNAME);
|
||||
$this->user->setPassword(self::PASSWORD);
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -44,14 +44,4 @@ class UserTest extends TestCase
|
||||
{
|
||||
$this->assertInstanceOf(UserSource::class, $this->user->getSource());
|
||||
}
|
||||
|
||||
public function testNode(): void
|
||||
{
|
||||
$this->assertInstanceOf(Relation::class, $this->user->getSource()->getNode());
|
||||
}
|
||||
|
||||
public function testLaw(): void
|
||||
{
|
||||
$this->assertInstanceOf(Law::class, $this->user->getSource()->getNode()->getLaw());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user