Changed combination to complex

This commit is contained in:
Kevin Frantz
2018-11-21 17:55:48 +01:00
parent 706a439b52
commit 999d17ad28
19 changed files with 29 additions and 29 deletions

View File

@@ -0,0 +1,42 @@
<?php
namespace tests\unit\Entity\Source\Complex;
use PHPUnit\Framework\TestCase;
use App\Entity\Source\Complex\FullPersonNameSourceInterface;
use App\Entity\Source\Complex\FullPersonNameSource;
use App\Entity\Source\Primitive\Name\SurnameSourceInterface;
use App\Entity\Source\Primitive\Name\FirstNameSourceInterface;
class FullPersonNameSourceTest extends TestCase
{
/**
* @var FullPersonNameSourceInterface
*/
protected $name;
public function setUp(): void
{
$this->name = new FullPersonNameSource();
}
public function testConstructor(): void
{
$this->assertInstanceOf(SurnameSourceInterface::class, $this->name->getSurnameSource());
$this->assertInstanceOf(FirstNameSourceInterface::class, $this->name->getFirstNameSource());
}
public function testFirstNameAccessor(): void
{
$name = $this->createMock(FirstNameSourceInterface::class);
$this->assertNull($this->name->setFirstNameSource($name));
$this->assertEquals($name, $this->name->getFirstNameSource());
}
public function testSurnameAccessor(): void
{
$name = $this->createMock(SurnameSourceInterface::class);
$this->assertNull($this->name->setSurnameSource($name));
$this->assertEquals($name, $this->name->getSurnameSource());
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace tests\unit\Entity\Source\Complex;
use PHPUnit\Framework\TestCase;
use App\Entity\Source\Complex\PersonIdentitySourceInterface;
use App\Entity\Source\Complex\PersonIdentitySource;
use App\Entity\Source\Complex\FullPersonNameSourceInterface;
class PersonIdentitySourceTest extends TestCase
{
/**
* @var PersonIdentitySourceInterface
*/
protected $identity;
public function setUp(): void
{
$this->identity = new PersonIdentitySource();
}
public function testConstructor(): void
{
$this->assertInstanceOf(FullPersonNameSourceInterface::class, $this->identity->getFullPersonNameSource());
}
public function testFullName(): void
{
$name = $this->createMock(FullPersonNameSourceInterface::class);
$this->assertNull($this->identity->setFullPersonNameSource($name));
$this->assertEquals($name, $this->identity->getFullPersonNameSource());
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace tests\unit\Entity\Source\Complex;
use PHPUnit\Framework\TestCase;
use App\Entity\Source\Complex\UserSourceInterface;
use App\Entity\Source\Complex\UserSource;
use Doctrine\Common\Collections\Collection;
use App\Entity\Source\Complex\PersonIdentitySourceInterface;
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(PersonIdentitySourceInterface::class, $this->userSource->getPersonIdentitySource());
$this->expectException(\TypeError::class);
$this->userSource->getUser();
}
}