2018-12-30 16:21:43 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Integration\Domain\SourceManagement;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use App\Entity\Source\SourceInterface;
|
|
|
|
use App\Domain\SourceManagement\SourceMemberManagerInterface;
|
|
|
|
use App\Domain\SourceManagement\SourceMemberManager;
|
|
|
|
use App\Domain\SourceManagement\SourceMemberInformation;
|
2018-12-30 17:09:44 +01:00
|
|
|
use App\Domain\SourceManagement\SourceMembershipInformation;
|
2019-01-04 22:09:05 +01:00
|
|
|
use App\Entity\Source\PureSource;
|
2018-12-30 16:21:43 +01:00
|
|
|
|
|
|
|
class SourceMemberManagerIntegrationTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var SourceInterface
|
|
|
|
*/
|
|
|
|
private $source;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var SourceMemberManagerInterface
|
|
|
|
*/
|
|
|
|
private $sourceMemberManager;
|
|
|
|
|
|
|
|
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
|
|
|
}
|