mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-10 06:27:24 +01:00
Implemented some tests for UserSource and deleted unnecessary attributs
This commit is contained in:
parent
03ce3f5cdf
commit
00ae6412e6
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Entity\Attribut;
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
use App\Entity\Source\NameSourceInterface;
|
use App\Entity\Source\Data\NameSourceInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Entity\Attribut;
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
use App\Entity\Source\NameSourceInterface;
|
use App\Entity\Source\Data\NameSourceInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Entity\Attribut;
|
|
||||||
|
|
||||||
use App\Entity\Source\UserSourceInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kevinfrantz
|
|
||||||
*/
|
|
||||||
trait UserSource
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var UserSourceInterface
|
|
||||||
* @ORM\OneToOne(targetEntity="UserSource",cascade={"persist", "remove"})
|
|
||||||
* @ORM\JoinColumn(name="source_user_id", referencedColumnName="id")
|
|
||||||
*/
|
|
||||||
protected $userSource;
|
|
||||||
|
|
||||||
public function setUserSource(UserSourceInterface $userSource): void
|
|
||||||
{
|
|
||||||
$this->user = $userSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUserSource(): UserSourceInterface
|
|
||||||
{
|
|
||||||
return $this->userSource;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Entity\Attribut;
|
|
||||||
|
|
||||||
use App\Entity\Source\UserSourceInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kevinfrantz
|
|
||||||
*/
|
|
||||||
interface UserSourceAttributInterface
|
|
||||||
{
|
|
||||||
public function setUserSource(UserSourceInterface $user): void;
|
|
||||||
|
|
||||||
public function getUserSource(): UserSourceInterface;
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Entity\Attribut;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This trait doesn't need an own interface because it's covered by symfony.
|
|
||||||
*
|
|
||||||
* @author kevinfrantz
|
|
||||||
*/
|
|
||||||
trait UsernameAttribut
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="string", length=25, unique=true)
|
|
||||||
*/
|
|
||||||
protected $username;
|
|
||||||
|
|
||||||
public function getUsername(): ?string
|
|
||||||
{
|
|
||||||
return $this->username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setUsername(string $username): void
|
|
||||||
{
|
|
||||||
$this->username = \trim($username);
|
|
||||||
}
|
|
||||||
}
|
|
27
application/tests/Unit/Entity/Source/Data/UserSourceTest.php
Normal file
27
application/tests/Unit/Entity/Source/Data/UserSourceTest.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
namespace tests\unit\Entity\Source\Data;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use App\Entity\Source\Data\UserSourceInterface;
|
||||||
|
use App\Entity\Source\Data\UserSource;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use App\Entity\Source\Data\NameSourceInterface;
|
||||||
|
|
||||||
|
class UserSourceTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var UserSourceInterface
|
||||||
|
*/
|
||||||
|
public $userSource;
|
||||||
|
|
||||||
|
public function setUp():void{
|
||||||
|
$this->userSource = new UserSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstructor():void {
|
||||||
|
$this->assertInstanceOf(Collection::class, $this->userSource->getMemberships());
|
||||||
|
$this->assertInstanceOf(NameSourceInterface::class, $this->userSource->getNameSource());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user