| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?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 PHPUnit\Framework\TestCase;
- use App\Service\Network\Utils;
- class UtilsTest extends TestCase
- {
- private Utils $utils;
- private Organization $organizationCmf;
- private Organization $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);
- }
- }
|