infinito/application/symfony/tests/Integration/Domain/Source/SourceMemberManagerIntegrationTest.php

56 lines
1.8 KiB
PHP
Raw Normal View History

2018-12-30 16:21:43 +01:00
<?php
namespace Tests\Integration\Domain\Source;
2018-12-30 16:21:43 +01:00
use PHPUnit\Framework\TestCase;
use Infinito\Entity\Source\SourceInterface;
use Infinito\Domain\Source\SourceMemberManagerInterface;
use Infinito\Domain\Source\SourceMemberManager;
use Infinito\Domain\Source\SourceMemberInformation;
use Infinito\Domain\Source\SourceMembershipInformation;
use Infinito\Entity\Source\PureSource;
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
{
$this->source = new PureSource();
2018-12-30 16:21:43 +01:00
$this->sourceMemberManager = new SourceMemberManager($this->source);
}
public function testSourceMemberInformationIntegration(): void
{
$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
{
$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
}