2018-12-30 16:21:43 +01:00
|
|
|
<?php
|
|
|
|
|
2019-05-30 17:04:46 +02:00
|
|
|
namespace Tests\Integration\Domain\Source;
|
2018-12-30 16:21:43 +01:00
|
|
|
|
2019-05-30 17:04:46 +02:00
|
|
|
use Infinito\Domain\Source\SourceMemberInformation;
|
2020-04-02 21:13:35 +02:00
|
|
|
use Infinito\Domain\Source\SourceMemberManager;
|
|
|
|
use Infinito\Domain\Source\SourceMemberManagerInterface;
|
2019-05-30 17:04:46 +02:00
|
|
|
use Infinito\Domain\Source\SourceMembershipInformation;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Entity\Source\PureSource;
|
2020-04-02 21:13:35 +02:00
|
|
|
use Infinito\Entity\Source\SourceInterface;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2018-12-30 16:21:43 +01:00
|
|
|
|
|
|
|
class SourceMemberManagerIntegrationTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var SourceInterface
|
|
|
|
*/
|
|
|
|
private $source;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var SourceMemberManagerInterface
|
|
|
|
*/
|
|
|
|
private $sourceMemberManager;
|
|
|
|
|
2019-02-12 18:04:36 +01:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*
|
|
|
|
* @see \PHPUnit\Framework\TestCase::setUp()
|
|
|
|
*/
|
2018-12-30 16:21:43 +01:00
|
|
|
public function setUp(): void
|
|
|
|
{
|
2019-01-04 22:09:05 +01:00
|
|
|
$this->source = new PureSource();
|
2018-12-30 16:21:43 +01:00
|
|
|
$this->sourceMemberManager = new SourceMemberManager($this->source);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testSourceMemberInformationIntegration(): void
|
|
|
|
{
|
2019-01-04 22:09:05 +01:00
|
|
|
$childSource = new PureSource();
|
2018-12-30 16:21:43 +01:00
|
|
|
$sourceMemberInformation = new SourceMemberInformation($this->source);
|
|
|
|
$this->sourceMemberManager->addMember($childSource);
|
|
|
|
$this->assertEquals($childSource, $sourceMemberInformation->getAllMembers()->get(0));
|
|
|
|
$this->sourceMemberManager->removeMember($childSource);
|
|
|
|
$this->assertEquals(0, $sourceMemberInformation->getAllMembers()->count());
|
|
|
|
}
|
2018-12-30 17:09:44 +01:00
|
|
|
|
|
|
|
public function testSourceMembershipInformationIntegration(): void
|
|
|
|
{
|
2019-01-04 22:09:05 +01:00
|
|
|
$parentSource = new PureSource();
|
2018-12-30 17:09:44 +01:00
|
|
|
$sourceMemberInformation = new SourceMembershipInformation($this->source);
|
|
|
|
$this->sourceMemberManager->addMembership($parentSource);
|
|
|
|
$this->assertEquals($parentSource, $sourceMemberInformation->getAllMemberships()->get(0));
|
|
|
|
$this->sourceMemberManager->removeMembership($parentSource);
|
|
|
|
$this->assertEquals(0, $sourceMemberInformation->getAllMemberships()->count());
|
|
|
|
}
|
2018-12-30 16:21:43 +01:00
|
|
|
}
|