Solved unit tests

This commit is contained in:
Kevin Frantz
2018-11-15 20:30:34 +01:00
parent de66375ee0
commit 7be76cac0d
14 changed files with 41 additions and 59 deletions

View File

@@ -3,8 +3,8 @@
namespace tests\unit\Entity\Source\Combination;
use PHPUnit\Framework\TestCase;
use App\Entity\Source\Data\PersonIdentitySourceInterface;
use App\Entity\Source\Data\PersonIdentitySource;
use App\Entity\Source\Combination\PersonIdentitySourceInterface;
use App\Entity\Source\Combination\PersonIdentitySource;
use App\Entity\Source\Combination\FullPersonNameSourceInterface;
class PersonIdentitySourceTest extends TestCase
@@ -12,15 +12,22 @@ class PersonIdentitySourceTest extends TestCase
/**
* @var PersonIdentitySourceInterface
*/
public $identitySource;
protected $identity;
public function setUp(): void
{
$this->userSource = new PersonIdentitySource();
$this->identity = new PersonIdentitySource();
}
public function testConstructor(): void
{
$this->assertInstanceOf(FullPersonNameSourceInterface::class, $this->identitySource->getFullPersonNameSource());
$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

@@ -6,7 +6,7 @@ use PHPUnit\Framework\TestCase;
use App\Entity\Source\Combination\UserSourceInterface;
use App\Entity\Source\Combination\UserSource;
use Doctrine\Common\Collections\Collection;
use App\Entity\Source\Data\PersonIdentitySourceInterface;
use App\Entity\Source\Combination\PersonIdentitySourceInterface;
class UserSourceTest extends TestCase
{
@@ -23,7 +23,7 @@ class UserSourceTest extends TestCase
public function testConstructor(): void
{
$this->assertInstanceOf(Collection::class, $this->userSource->getMemberships());
$this->assertInstanceOf(PersonIdentitySourceInterface::class, $this->userSource->getIdentitySource());
$this->assertInstanceOf(PersonIdentitySourceInterface::class, $this->userSource->getPersonIdentitySource());
$this->expectException(\TypeError::class);
$this->userSource->getUser();
}