|
|
@@ -1,4 +1,5 @@
|
|
|
<?php
|
|
|
+
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
namespace App\Tests\Unit\Service\Organization;
|
|
|
@@ -6,7 +7,6 @@ namespace App\Tests\Unit\Service\Organization;
|
|
|
use App\ApiResources\Organization\OrganizationCreationRequest;
|
|
|
use App\ApiResources\Organization\OrganizationMemberCreationRequest;
|
|
|
use App\Entity\Access\Access;
|
|
|
-use App\Entity\Core\AddressPostal;
|
|
|
use App\Entity\Core\ContactPoint;
|
|
|
use App\Entity\Core\Country;
|
|
|
use App\Entity\Education\Cycle;
|
|
|
@@ -49,7 +49,8 @@ use Psr\Log\LoggerInterface;
|
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
use Symfony\Contracts\HttpClient\ResponseInterface;
|
|
|
|
|
|
-class TestableOrganizationFactory extends OrganizationFactory {
|
|
|
+class TestableOrganizationFactory extends OrganizationFactory
|
|
|
+{
|
|
|
public function setPhoneNumberUtil(PhoneNumberUtil $phoneNumberUtil): void
|
|
|
{
|
|
|
$this->phoneNumberUtil = $phoneNumberUtil;
|
|
|
@@ -66,60 +67,73 @@ class TestableOrganizationFactory extends OrganizationFactory {
|
|
|
}
|
|
|
|
|
|
public function makeOrganizationWithRelations(
|
|
|
- OrganizationCreationRequest $organizationCreationRequest
|
|
|
+ OrganizationCreationRequest $organizationCreationRequest,
|
|
|
): Organization {
|
|
|
return parent::makeOrganizationWithRelations($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function makeOrganization(OrganizationCreationRequest $organizationCreationRequest): Organization {
|
|
|
+ public function makeOrganization(OrganizationCreationRequest $organizationCreationRequest): Organization
|
|
|
+ {
|
|
|
return parent::makeOrganization($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function makeParameters(OrganizationCreationRequest $organizationCreationRequest): Parameters {
|
|
|
+ public function makeParameters(OrganizationCreationRequest $organizationCreationRequest): Parameters
|
|
|
+ {
|
|
|
return parent::makeParameters($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function makeSettings(OrganizationCreationRequest $organizationCreationRequest): Settings {
|
|
|
+ public function makeSettings(OrganizationCreationRequest $organizationCreationRequest): Settings
|
|
|
+ {
|
|
|
return parent::makeSettings($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function makePostalAddress(OrganizationCreationRequest $organizationCreationRequest): OrganizationAddressPostal {
|
|
|
+ public function makePostalAddress(OrganizationCreationRequest $organizationCreationRequest): OrganizationAddressPostal
|
|
|
+ {
|
|
|
return parent::makePostalAddress($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function makeContactPoint(OrganizationCreationRequest $organizationCreationRequest): ContactPoint {
|
|
|
+ public function makeContactPoint(OrganizationCreationRequest $organizationCreationRequest): ContactPoint
|
|
|
+ {
|
|
|
return parent::makeContactPoint($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function makeNetworkOrganization(OrganizationCreationRequest $organizationCreationRequest): NetworkOrganization {
|
|
|
+ public function makeNetworkOrganization(OrganizationCreationRequest $organizationCreationRequest): NetworkOrganization
|
|
|
+ {
|
|
|
return parent::makeNetworkOrganization($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function makeAdminAccess(OrganizationCreationRequest $organizationCreationRequest): Access {
|
|
|
+ public function makeAdminAccess(OrganizationCreationRequest $organizationCreationRequest): Access
|
|
|
+ {
|
|
|
return parent::makeAdminAccess($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function makeCycles(): array {
|
|
|
+ public function makeCycles(): array
|
|
|
+ {
|
|
|
return parent::makeCycles();
|
|
|
}
|
|
|
|
|
|
- public function makeAccess(int|OrganizationMemberCreationRequest $creationRequestData): Access {
|
|
|
+ public function makeAccess(int|OrganizationMemberCreationRequest $creationRequestData): Access
|
|
|
+ {
|
|
|
return parent::makeAccess($creationRequestData);
|
|
|
}
|
|
|
|
|
|
- public function makePersonPostalAddress(OrganizationMemberCreationRequest $organizationMemberCreationRequest): PersonAddressPostal {
|
|
|
+ public function makePersonPostalAddress(OrganizationMemberCreationRequest $organizationMemberCreationRequest): PersonAddressPostal
|
|
|
+ {
|
|
|
return parent::makePersonPostalAddress($organizationMemberCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function makePersonContactPoint(OrganizationMemberCreationRequest $organizationMemberCreationRequest): ContactPoint {
|
|
|
+ public function makePersonContactPoint(OrganizationMemberCreationRequest $organizationMemberCreationRequest): ContactPoint
|
|
|
+ {
|
|
|
return parent::makePersonContactPoint($organizationMemberCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function makeSubdomain(OrganizationCreationRequest $organizationCreationRequest): Subdomain {
|
|
|
+ public function makeSubdomain(OrganizationCreationRequest $organizationCreationRequest): Subdomain
|
|
|
+ {
|
|
|
return parent::makeSubdomain($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function createTypo3Website(Organization $organization): ?int {
|
|
|
+ public function createTypo3Website(Organization $organization): ?int
|
|
|
+ {
|
|
|
return parent::createTypo3Website($organization);
|
|
|
}
|
|
|
|
|
|
@@ -136,19 +150,19 @@ class TestableOrganizationFactory extends OrganizationFactory {
|
|
|
|
|
|
class OrganizationFactoryTest extends TestCase
|
|
|
{
|
|
|
- private readonly MockObject | SubdomainService $subdomainService;
|
|
|
- private readonly MockObject | OrganizationRepository $organizationRepository;
|
|
|
- private readonly MockObject | CountryRepository $countryRepository;
|
|
|
- private readonly MockObject | OrganizationUtils $organizationUtils;
|
|
|
- private readonly MockObject | Typo3Service $typo3Service;
|
|
|
- private readonly MockObject | DolibarrApiService $dolibarrApiService;
|
|
|
- private readonly MockObject | EntityManagerInterface $entityManager;
|
|
|
- private readonly MockObject | PersonRepository $personRepository;
|
|
|
- private readonly MockObject | BindFileService $bindFileService;
|
|
|
- private readonly MockObject | LoggerInterface $logger;
|
|
|
- private readonly MockObject | OrganizationIdentificationRepository $organizationIdentificationRepository;
|
|
|
- private readonly MockObject | ApiLegacyRequestService $apiLegacyRequestService;
|
|
|
- private readonly MockObject | PhoneNumberUtil $phoneNumberUtil;
|
|
|
+ private readonly MockObject|SubdomainService $subdomainService;
|
|
|
+ private readonly MockObject|OrganizationRepository $organizationRepository;
|
|
|
+ private readonly MockObject|CountryRepository $countryRepository;
|
|
|
+ private readonly MockObject|OrganizationUtils $organizationUtils;
|
|
|
+ private readonly MockObject|Typo3Service $typo3Service;
|
|
|
+ private readonly MockObject|DolibarrApiService $dolibarrApiService;
|
|
|
+ private readonly MockObject|EntityManagerInterface $entityManager;
|
|
|
+ private readonly MockObject|PersonRepository $personRepository;
|
|
|
+ private readonly MockObject|BindFileService $bindFileService;
|
|
|
+ private readonly MockObject|LoggerInterface $logger;
|
|
|
+ private readonly MockObject|OrganizationIdentificationRepository $organizationIdentificationRepository;
|
|
|
+ private readonly MockObject|ApiLegacyRequestService $apiLegacyRequestService;
|
|
|
+ private readonly MockObject|PhoneNumberUtil $phoneNumberUtil;
|
|
|
|
|
|
public function setUp(): void
|
|
|
{
|
|
|
@@ -172,7 +186,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
DatesUtils::clearFakeDatetime();
|
|
|
}
|
|
|
|
|
|
- private function getOrganizationFactoryMockFor(string $methodName): TestableOrganizationFactory | MockObject
|
|
|
+ private function getOrganizationFactoryMockFor(string $methodName): TestableOrganizationFactory|MockObject
|
|
|
{
|
|
|
$organizationFactory = $this
|
|
|
->getMockBuilder(TestableOrganizationFactory::class)
|
|
|
@@ -188,17 +202,19 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$this->personRepository,
|
|
|
$this->bindFileService,
|
|
|
$this->organizationIdentificationRepository,
|
|
|
- $this->apiLegacyRequestService
|
|
|
+ $this->apiLegacyRequestService,
|
|
|
])
|
|
|
->setMethodsExcept(['setLoggerInterface', 'setPhoneNumberUtil', $methodName])
|
|
|
->getMock();
|
|
|
|
|
|
$organizationFactory->setLoggerInterface($this->logger);
|
|
|
$organizationFactory->setPhoneNumberUtil($this->phoneNumberUtil);
|
|
|
+
|
|
|
return $organizationFactory;
|
|
|
}
|
|
|
|
|
|
- public function testCreate(): void {
|
|
|
+ public function testCreate(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('create');
|
|
|
|
|
|
$organizationCreationRequest = $this->getMockBuilder(OrganizationCreationRequest::class)->getMock();
|
|
|
@@ -245,12 +261,12 @@ class OrganizationFactoryTest extends TestCase
|
|
|
->withConsecutive(
|
|
|
["Start the creation of a new organization named 'foo'"],
|
|
|
["Subdomain is valid and available : 'subdomain'"],
|
|
|
- ["Organization created with all its relations"],
|
|
|
- ["Organization persisted in the DB"],
|
|
|
- ["New dolibarr structure created (uid : 456)"],
|
|
|
- ["Subdomain registered"],
|
|
|
- ["Typo3 website created (root uid: 789)"],
|
|
|
- ["Adminassos db updated"]
|
|
|
+ ['Organization created with all its relations'],
|
|
|
+ ['Organization persisted in the DB'],
|
|
|
+ ['New dolibarr structure created (uid : 456)'],
|
|
|
+ ['Subdomain registered'],
|
|
|
+ ['Typo3 website created (root uid: 789)'],
|
|
|
+ ['Adminassos db updated']
|
|
|
);
|
|
|
|
|
|
$organizationCreationRequest
|
|
|
@@ -266,7 +282,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- public function testCreateWithRollback(): void {
|
|
|
+ public function testCreateWithRollback(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('create');
|
|
|
|
|
|
$organizationCreationRequest = $this->getMockBuilder(OrganizationCreationRequest::class)->getMock();
|
|
|
@@ -308,7 +325,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
->withConsecutive(
|
|
|
["Start the creation of a new organization named 'foo'"],
|
|
|
["Subdomain is valid and available : 'subdomain'"],
|
|
|
- ["Organization created with all its relations"]
|
|
|
+ ['Organization created with all its relations']
|
|
|
);
|
|
|
|
|
|
$this->logger
|
|
|
@@ -322,7 +339,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$result = $organizationFactory->create($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function testCreateWithExistingOrganization(): void {
|
|
|
+ public function testCreateWithExistingOrganization(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('create');
|
|
|
|
|
|
$organizationCreationRequest = $this->getMockBuilder(OrganizationCreationRequest::class)->getMock();
|
|
|
@@ -367,12 +385,13 @@ class OrganizationFactoryTest extends TestCase
|
|
|
);
|
|
|
|
|
|
$this->expectException(\RuntimeException::class);
|
|
|
- $this->expectExceptionMessage("An organization named foo already exists");
|
|
|
+ $this->expectExceptionMessage('An organization named foo already exists');
|
|
|
|
|
|
$result = $organizationFactory->create($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function testCreateNoWebsiteAndIsClient(): void {
|
|
|
+ public function testCreateNoWebsiteAndIsClient(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('create');
|
|
|
|
|
|
$organizationCreationRequest = $this->getMockBuilder(OrganizationCreationRequest::class)->getMock();
|
|
|
@@ -402,7 +421,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$this->logger
|
|
|
->expects(self::once())
|
|
|
->method('warning')
|
|
|
- ->with("Typo3 website creation was not required");
|
|
|
+ ->with('Typo3 website creation was not required');
|
|
|
|
|
|
$result = $organizationFactory->create($organizationCreationRequest);
|
|
|
|
|
|
@@ -412,7 +431,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- public function testCreateWithErrors(): void {
|
|
|
+ public function testCreateWithErrors(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('create');
|
|
|
|
|
|
$organizationCreationRequest = $this->getMockBuilder(OrganizationCreationRequest::class)->getMock();
|
|
|
@@ -463,7 +483,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$this->logger
|
|
|
->expects(self::once())
|
|
|
->method('warning')
|
|
|
- ->with("-- Operation ended with errors, check the logs for more information --");
|
|
|
+ ->with('-- Operation ended with errors, check the logs for more information --');
|
|
|
|
|
|
$organizationCreationRequest
|
|
|
->expects(self::once())
|
|
|
@@ -502,7 +522,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
->method('normalizeIdentificationField')
|
|
|
->willReturnMap([
|
|
|
['foo', 'foo'],
|
|
|
- ['part1 part2 part3', 'part1 part2 part3']
|
|
|
+ ['part1 part2 part3', 'part1 part2 part3'],
|
|
|
]);
|
|
|
|
|
|
$organizationFactory->interruptIfOrganizationExists($organizationCreationRequest);
|
|
|
@@ -527,7 +547,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
->method('normalizeIdentificationField')
|
|
|
->willReturnMap([
|
|
|
['foo', 'foo'],
|
|
|
- ['part1 part2 part3', 'part1 part2 part3']
|
|
|
+ ['part1 part2 part3', 'part1 part2 part3'],
|
|
|
]);
|
|
|
|
|
|
$this->organizationIdentificationRepository
|
|
|
@@ -563,7 +583,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
->method('normalizeIdentificationField')
|
|
|
->willReturnMap([
|
|
|
['foo', 'foo'],
|
|
|
- ['part1 part2 part3', 'part1 part2 part3']
|
|
|
+ ['part1 part2 part3', 'part1 part2 part3'],
|
|
|
]);
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
|
@@ -603,7 +623,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
->method('normalizeIdentificationField')
|
|
|
->willReturnMap([
|
|
|
['foo', 'foo'],
|
|
|
- ['part1 part2 part3', 'part1 part2 part3']
|
|
|
+ ['part1 part2 part3', 'part1 part2 part3'],
|
|
|
]);
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
|
@@ -643,7 +663,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
->method('normalizeIdentificationField')
|
|
|
->willReturnMap([
|
|
|
['foo', 'foo'],
|
|
|
- ['part1 part2 part3', 'part1 part2 part3']
|
|
|
+ ['part1 part2 part3', 'part1 part2 part3'],
|
|
|
]);
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
|
@@ -683,7 +703,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
->method('normalizeIdentificationField')
|
|
|
->willReturnMap([
|
|
|
['foo', 'foo'],
|
|
|
- ['part1 part2 part3', 'part1 part2 part3']
|
|
|
+ ['part1 part2 part3', 'part1 part2 part3'],
|
|
|
]);
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
|
@@ -723,7 +743,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
->method('normalizeIdentificationField')
|
|
|
->willReturnMap([
|
|
|
['foo', 'foo'],
|
|
|
- ['part1 part2 part3', 'part1 part2 part3']
|
|
|
+ ['part1 part2 part3', 'part1 part2 part3'],
|
|
|
]);
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
|
@@ -739,12 +759,13 @@ class OrganizationFactoryTest extends TestCase
|
|
|
]);
|
|
|
|
|
|
$this->expectException(\RuntimeException::class);
|
|
|
- $this->expectExceptionMessage("An organization already exists at this address.");
|
|
|
+ $this->expectExceptionMessage('An organization already exists at this address.');
|
|
|
|
|
|
$organizationFactory->interruptIfOrganizationExists($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function testValidateSubdomain(): void {
|
|
|
+ public function testValidateSubdomain(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('validateSubdomain');
|
|
|
|
|
|
$this->subdomainService->expects(self::once())->method('isValidSubdomain')->willReturn(true);
|
|
|
@@ -754,7 +775,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$organizationFactory->validateSubdomain('foo');
|
|
|
}
|
|
|
|
|
|
- public function testValidateSubdomainIsNotValid(): void {
|
|
|
+ public function testValidateSubdomainIsNotValid(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('validateSubdomain');
|
|
|
|
|
|
$this->subdomainService->method('isValidSubdomain')->willReturn(false);
|
|
|
@@ -762,12 +784,13 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$this->subdomainService->method('isRegistered')->willReturn(false);
|
|
|
|
|
|
$this->expectException(\RuntimeException::class);
|
|
|
- $this->expectExceptionMessage("Not a valid subdomain : foo");
|
|
|
+ $this->expectExceptionMessage('Not a valid subdomain : foo');
|
|
|
|
|
|
$organizationFactory->validateSubdomain('foo');
|
|
|
}
|
|
|
|
|
|
- public function testValidateSubdomainIsReserved(): void {
|
|
|
+ public function testValidateSubdomainIsReserved(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('validateSubdomain');
|
|
|
|
|
|
$this->subdomainService->method('isValidSubdomain')->willReturn(true);
|
|
|
@@ -775,12 +798,13 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$this->subdomainService->method('isRegistered')->willReturn(false);
|
|
|
|
|
|
$this->expectException(\RuntimeException::class);
|
|
|
- $this->expectExceptionMessage("This subdomain is not available : foo");
|
|
|
+ $this->expectExceptionMessage('This subdomain is not available : foo');
|
|
|
|
|
|
$organizationFactory->validateSubdomain('foo');
|
|
|
}
|
|
|
|
|
|
- public function testValidateSubdomainIsRegistered(): void {
|
|
|
+ public function testValidateSubdomainIsRegistered(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('validateSubdomain');
|
|
|
|
|
|
$this->subdomainService->method('isValidSubdomain')->willReturn(true);
|
|
|
@@ -788,7 +812,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$this->subdomainService->method('isRegistered')->willReturn(true);
|
|
|
|
|
|
$this->expectException(\RuntimeException::class);
|
|
|
- $this->expectExceptionMessage("This subdomain is already registered : foo");
|
|
|
+ $this->expectExceptionMessage('This subdomain is already registered : foo');
|
|
|
|
|
|
$organizationFactory->validateSubdomain('foo');
|
|
|
}
|
|
|
@@ -893,9 +917,9 @@ class OrganizationFactoryTest extends TestCase
|
|
|
->expects(self::exactly(2))
|
|
|
->method('makeAccess')
|
|
|
->willReturnMap([
|
|
|
- [$organizationMemberCreationRequest1, $access1],
|
|
|
- [$organizationMemberCreationRequest2, $access2]
|
|
|
- ]);
|
|
|
+ [$organizationMemberCreationRequest1, $access1],
|
|
|
+ [$organizationMemberCreationRequest2, $access2],
|
|
|
+ ]);
|
|
|
|
|
|
$organization
|
|
|
->expects(self::exactly(3))
|
|
|
@@ -927,7 +951,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- public function testMakeOrganizationWithRelationsNoPresidentNoDirector() {
|
|
|
+ public function testMakeOrganizationWithRelationsNoPresidentNoDirector()
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('makeOrganizationWithRelations');
|
|
|
|
|
|
$organizationCreationRequest = $this->getMockBuilder(OrganizationCreationRequest::class)->getMock();
|
|
|
@@ -1075,7 +1100,6 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$this->expectExceptionMessage('No country found for id 1');
|
|
|
|
|
|
$organizationFactory->makePostalAddress($organizationCreationRequest);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public function testMakeContactPoint(): void
|
|
|
@@ -1139,7 +1163,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$organizationFactory->makeContactPoint($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function testMakeNetworkOrganization(): void {
|
|
|
+ public function testMakeNetworkOrganization(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('makeNetworkOrganization');
|
|
|
|
|
|
DatesUtils::setFakeDatetime('2024-01-01');
|
|
|
@@ -1180,7 +1205,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- public function testMakeNetworkOrganizationMissingParent(): void {
|
|
|
+ public function testMakeNetworkOrganizationMissingParent(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('makeNetworkOrganization');
|
|
|
|
|
|
$organizationCreationRequest = $this->getMockBuilder(OrganizationCreationRequest::class)->getMock();
|
|
|
@@ -1194,8 +1220,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$organizationFactory->makeNetworkOrganization($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- public function testMakeNetworkOrganizationParentIsNotManager(): void {
|
|
|
+ public function testMakeNetworkOrganizationParentIsNotManager(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('makeNetworkOrganization');
|
|
|
|
|
|
DatesUtils::setFakeDatetime('2024-01-01');
|
|
|
@@ -1215,7 +1241,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$organizationFactory->makeNetworkOrganization($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function testMakeNetworkOrganizationMissingNetwork(): void {
|
|
|
+ public function testMakeNetworkOrganizationMissingNetwork(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('makeNetworkOrganization');
|
|
|
|
|
|
$organizationCreationRequest = $this->getMockBuilder(OrganizationCreationRequest::class)->getMock();
|
|
|
@@ -1235,7 +1262,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$organizationFactory->makeNetworkOrganization($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function testMakeNetworkOrganizationIsCMFInvalidIdentifier(): void {
|
|
|
+ public function testMakeNetworkOrganizationIsCMFInvalidIdentifier(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('makeNetworkOrganization');
|
|
|
|
|
|
$organizationCreationRequest = $this->getMockBuilder(OrganizationCreationRequest::class)->getMock();
|
|
|
@@ -1260,12 +1288,13 @@ class OrganizationFactoryTest extends TestCase
|
|
|
->willReturn($networkOrganization);
|
|
|
|
|
|
$this->expectException(\RuntimeException::class);
|
|
|
- $this->expectExceptionMessage("CMF identifier is missing or invalid.");
|
|
|
+ $this->expectExceptionMessage('CMF identifier is missing or invalid.');
|
|
|
|
|
|
$organizationFactory->makeNetworkOrganization($organizationCreationRequest);
|
|
|
}
|
|
|
|
|
|
- public function testMakeNetworkOrganizationIsNotCMFInvalidIdentifier(): void {
|
|
|
+ public function testMakeNetworkOrganizationIsNotCMFInvalidIdentifier(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('makeNetworkOrganization');
|
|
|
|
|
|
$organizationCreationRequest = $this->getMockBuilder(OrganizationCreationRequest::class)->getMock();
|
|
|
@@ -1354,7 +1383,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$this->assertFalse(
|
|
|
$cycle->getIsSystem()
|
|
|
);
|
|
|
- $i++;
|
|
|
+ ++$i;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1509,7 +1538,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- public function testMakePersonContactPointNoMobile(): void {
|
|
|
+ public function testMakePersonContactPointNoMobile(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('makePersonContactPoint');
|
|
|
|
|
|
$organizationMemberCreationRequest = $this->getMockBuilder(OrganizationMemberCreationRequest::class)->getMock();
|
|
|
@@ -1545,7 +1575,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- public function testCreateTypo3Website(): void {
|
|
|
+ public function testCreateTypo3Website(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('createTypo3Website');
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
|
@@ -1569,7 +1600,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- public function testCreateTypo3WebsiteWithError(): void {
|
|
|
+ public function testCreateTypo3WebsiteWithError(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('createTypo3Website');
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
|
@@ -1591,7 +1623,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$this->assertNull($result);
|
|
|
}
|
|
|
|
|
|
- public function testCreateTypo3WebsiteWithInvalidResponse(): void {
|
|
|
+ public function testCreateTypo3WebsiteWithInvalidResponse(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('createTypo3Website');
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
|
@@ -1613,7 +1646,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$this->assertNull($result);
|
|
|
}
|
|
|
|
|
|
- public function testUpdateAdminassosDb(): void {
|
|
|
+ public function testUpdateAdminassosDb(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('updateAdminassosDb');
|
|
|
|
|
|
$response = $this->getMockBuilder(ResponseInterface::class)->disableOriginalConstructor()->getMock();
|
|
|
@@ -1622,7 +1656,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$this->apiLegacyRequestService
|
|
|
->expects(self::once())
|
|
|
->method('post')
|
|
|
- ->with('/_internal/secure/organization/creation-event', [ 'organizationId' => 123 ])
|
|
|
+ ->with('/_internal/secure/organization/creation-event', ['organizationId' => 123])
|
|
|
->willReturn($response);
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
|
@@ -1631,7 +1665,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$organizationFactory->updateAdminassosDb($organization);
|
|
|
}
|
|
|
|
|
|
- public function testUpdateAdminassosDbError(): void {
|
|
|
+ public function testUpdateAdminassosDbError(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('updateAdminassosDb');
|
|
|
|
|
|
$response = $this->getMockBuilder(ResponseInterface::class)->disableOriginalConstructor()->getMock();
|
|
|
@@ -1641,7 +1676,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$this->apiLegacyRequestService
|
|
|
->expects(self::once())
|
|
|
->method('post')
|
|
|
- ->with('/_internal/secure/organization/creation-event', [ 'organizationId' => 123 ])
|
|
|
+ ->with('/_internal/secure/organization/creation-event', ['organizationId' => 123])
|
|
|
->willReturn($response);
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
|
@@ -1653,7 +1688,8 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$organizationFactory->updateAdminassosDb($organization);
|
|
|
}
|
|
|
|
|
|
- public function testNormalizeIdentificationField(): void {
|
|
|
+ public function testNormalizeIdentificationField(): void
|
|
|
+ {
|
|
|
$organizationFactory = $this->getOrganizationFactoryMockFor('normalizeIdentificationField');
|
|
|
|
|
|
$this->assertEquals(
|
|
|
@@ -1661,5 +1697,4 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$organizationFactory->normalizeIdentificationField("C'est une phrase normalisée.")
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
}
|