| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- namespace App\Tests\Service\Network;
- use App\Entity\Network\Network;
- use App\Entity\Network\NetworkOrganization;
- use App\Entity\Organization\Organization;
- use App\Enum\Network\NetworkEnum;
- use Doctrine\Common\Collections\ArrayCollection;
- use PHPUnit\Framework\TestCase;
- use App\Service\Network\Utils;
- class UtilsTest extends TestCase
- {
- /** @var Utils */
- private $utils;
- private $organizationCmf;
- private $organizationFfec;
- public function setUp():void
- {
- $networkCmf = new Network();
- $networkCmf->setId(3);
- $networkCmf->setName('CMF');
- $networkOrganization = new NetworkOrganization();
- $networkOrganization->setNetwork($networkCmf);
- $this->organizationCmf = new Organization();
- $this->organizationCmf->addNetworkOrganization($networkOrganization);
- $networkFfec = new Network();
- $networkFfec->setId(4);
- $networkFfec->setName('FFEC');
- $networkOrganization = new NetworkOrganization();
- $networkOrganization->setNetwork($networkFfec);
- $this->organizationFfec = new Organization();
- $this->organizationFfec->addNetworkOrganization($networkOrganization);
- $this->utils = new Utils();
- }
- /**
- * @see Utils::isCMF()
- */
- public function testIsCmf():void
- {
- $result = $this->utils->isCmf($this->organizationCmf);
- $this->assertTrue($result);
- }
- /**
- * @see Utils::isCMF()
- */
- public function testIsNotCmf():void
- {
- $result = $this->utils->isCmf($this->organizationFfec);
- $this->assertFalse($result);
- }
- /**
- * @see Utils::isOrganizationBelongToTheNetwork()
- */
- public function testIsOrganizationBelongToTheNetwork():void
- {
- $result = $this->utils->isOrganizationBelongToTheNetwork($this->organizationCmf, NetworkEnum::CMF());
- $this->assertTrue($result);
- }
- /**
- * @see Utils::isOrganizationBelongToTheNetwork()
- */
- public function testIsOrganizationNotBelongToTheNetwork():void
- {
- $result = $this->utils->isOrganizationBelongToTheNetwork($this->organizationCmf, NetworkEnum::FFEC());
- $this->assertFalse($result);
- }
- }
|