|
|
@@ -970,12 +970,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
|
|
|
$organization->expects(self::once())->method('addSubdomain')->with($subdomain);
|
|
|
|
|
|
- // Enregistrement du sous domaine dans Parameters (retrocompatibilité v1)
|
|
|
- $organization->method('getParameters')->willReturn($parameters);
|
|
|
-
|
|
|
$organizationCreationRequest->method('getSubdomain')->willReturn('foo');
|
|
|
- $parameters->expects(self::once())->method('setSubDomain')->with('foo');
|
|
|
- $parameters->expects(self::once())->method('setOtherWebsite')->with('https://foo.opentalent.fr');
|
|
|
|
|
|
$result = $organizationFactory->makeOrganizationWithRelations($organizationCreationRequest);
|
|
|
|
|
|
@@ -1142,21 +1137,9 @@ class OrganizationFactoryTest extends TestCase
|
|
|
|
|
|
$organizationCreationRequest = $this->getMockBuilder(OrganizationCreationRequest::class)->getMock();
|
|
|
|
|
|
- $organizationCreationRequest->method('getPhoneNumber')->willReturn('+33102030405');
|
|
|
- $organizationCreationRequest->method('getEmail')->willReturn('contact@domain.net');
|
|
|
-
|
|
|
- $this->phoneNumberUtil
|
|
|
- ->method('isPossibleNumber')
|
|
|
- ->with('+33102030405')
|
|
|
- ->willReturn(true);
|
|
|
-
|
|
|
$phoneNumber = $this->getMockBuilder(PhoneNumber::class)->getMock();
|
|
|
-
|
|
|
- $this->phoneNumberUtil
|
|
|
- ->expects(self::once())
|
|
|
- ->method('parse')
|
|
|
- ->with('+33102030405')
|
|
|
- ->willReturn($phoneNumber);
|
|
|
+ $organizationCreationRequest->method('getPhoneNumber')->willReturn($phoneNumber);
|
|
|
+ $organizationCreationRequest->method('getEmail')->willReturn('contact@domain.net');
|
|
|
|
|
|
$contactPoint = $organizationFactory->makeContactPoint($organizationCreationRequest);
|
|
|
|
|
|
@@ -1171,31 +1154,6 @@ class OrganizationFactoryTest extends TestCase
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- public function testMakeContactPointInvalidPhoneNumber(): void
|
|
|
- {
|
|
|
- $organizationFactory = $this->getOrganizationFactoryMockFor('makeContactPoint');
|
|
|
-
|
|
|
- $organizationCreationRequest = $this->getMockBuilder(OrganizationCreationRequest::class)->getMock();
|
|
|
-
|
|
|
- $organizationCreationRequest->method('getPhoneNumber')->willReturn('invalid');
|
|
|
- $organizationCreationRequest->method('getEmail')->willReturn('contact@domain.net');
|
|
|
-
|
|
|
- $this->phoneNumberUtil
|
|
|
- ->method('isPossibleNumber')
|
|
|
- ->with('invalid')
|
|
|
- ->willReturn(false);
|
|
|
-
|
|
|
- $phoneNumber = $this->getMockBuilder(PhoneNumber::class)->getMock();
|
|
|
-
|
|
|
- $this->phoneNumberUtil
|
|
|
- ->expects(self::never())
|
|
|
- ->method('parse');
|
|
|
-
|
|
|
- $this->expectException(\RuntimeException::class);
|
|
|
- $this->expectExceptionMessage('Phone number is invalid or missing');
|
|
|
-
|
|
|
- $organizationFactory->makeContactPoint($organizationCreationRequest);
|
|
|
- }
|
|
|
|
|
|
public function testMakeNetworkOrganization(): void
|
|
|
{
|
|
|
@@ -1635,28 +1593,24 @@ class OrganizationFactoryTest extends TestCase
|
|
|
|
|
|
$organizationMemberCreationRequest = $this->getMockBuilder(OrganizationMemberCreationRequest::class)->getMock();
|
|
|
|
|
|
- $organizationMemberCreationRequest->method('getPhone')->willReturn('+33102030405');
|
|
|
+ $phoneNumber = $this->getMockBuilder(PhoneNumber::class)->getMock();
|
|
|
+ $mobilePhoneNumber = $this->getMockBuilder(PhoneNumber::class)->getMock();
|
|
|
+
|
|
|
+ $organizationMemberCreationRequest->method('getPhone')->willReturn($phoneNumber);
|
|
|
$organizationMemberCreationRequest->method('getEmail')->willReturn('email@domain.com');
|
|
|
- $organizationMemberCreationRequest->method('getMobile')->willReturn('+33607080910');
|
|
|
+ $organizationMemberCreationRequest->method('getMobile')->willReturn($mobilePhoneNumber);
|
|
|
|
|
|
$this->phoneNumberUtil
|
|
|
->expects(self::exactly(2))
|
|
|
->method('isPossibleNumber')
|
|
|
->willReturnMap([
|
|
|
- ['+33102030405', null, true],
|
|
|
- ['+33607080910', null, true],
|
|
|
+ [$phoneNumber, null, true],
|
|
|
+ [$mobilePhoneNumber, null, true],
|
|
|
]);
|
|
|
|
|
|
- $phoneNumber = $this->getMockBuilder(PhoneNumber::class)->getMock();
|
|
|
- $mobilePhoneNumber = $this->getMockBuilder(PhoneNumber::class)->getMock();
|
|
|
-
|
|
|
$this->phoneNumberUtil
|
|
|
- ->expects(self::exactly(2))
|
|
|
- ->method('parse')
|
|
|
- ->willReturnMap([
|
|
|
- ['+33102030405', null, null, false, $phoneNumber],
|
|
|
- ['+33607080910', null, null, false, $mobilePhoneNumber],
|
|
|
- ]);
|
|
|
+ ->expects(self::never())
|
|
|
+ ->method('parse');
|
|
|
|
|
|
$creationDate = $this->getMockBuilder(\DateTime::class)->getMock();
|
|
|
|
|
|
@@ -1693,15 +1647,18 @@ class OrganizationFactoryTest extends TestCase
|
|
|
|
|
|
$organizationMemberCreationRequest = $this->getMockBuilder(OrganizationMemberCreationRequest::class)->getMock();
|
|
|
|
|
|
+ $invalidPhoneNumber = $this->getMockBuilder(PhoneNumber::class)->getMock();
|
|
|
+ $mobilePhoneNumber = $this->getMockBuilder(PhoneNumber::class)->getMock();
|
|
|
+
|
|
|
$organizationMemberCreationRequest->method('getUsername')->willReturn('bob');
|
|
|
- $organizationMemberCreationRequest->method('getPhone')->willReturn('invalid');
|
|
|
+ $organizationMemberCreationRequest->method('getPhone')->willReturn($invalidPhoneNumber);
|
|
|
$organizationMemberCreationRequest->method('getEmail')->willReturn('email@domain.com');
|
|
|
- $organizationMemberCreationRequest->method('getMobile')->willReturn('+33607080910');
|
|
|
+ $organizationMemberCreationRequest->method('getMobile')->willReturn($mobilePhoneNumber);
|
|
|
|
|
|
$this->phoneNumberUtil
|
|
|
->expects(self::once())
|
|
|
->method('isPossibleNumber')
|
|
|
- ->with('invalid')
|
|
|
+ ->with($invalidPhoneNumber)
|
|
|
->willReturn(false);
|
|
|
|
|
|
$this->phoneNumberUtil
|
|
|
@@ -1726,17 +1683,20 @@ class OrganizationFactoryTest extends TestCase
|
|
|
|
|
|
$organizationMemberCreationRequest = $this->getMockBuilder(OrganizationMemberCreationRequest::class)->getMock();
|
|
|
|
|
|
+ $phoneNumber = $this->getMockBuilder(PhoneNumber::class)->getMock();
|
|
|
+ $invalidMobilePhoneNumber = $this->getMockBuilder(PhoneNumber::class)->getMock();
|
|
|
+
|
|
|
$organizationMemberCreationRequest->method('getUsername')->willReturn('bob');
|
|
|
- $organizationMemberCreationRequest->method('getPhone')->willReturn('+33102030405');
|
|
|
+ $organizationMemberCreationRequest->method('getPhone')->willReturn($phoneNumber);
|
|
|
$organizationMemberCreationRequest->method('getEmail')->willReturn('email@domain.com');
|
|
|
- $organizationMemberCreationRequest->method('getMobile')->willReturn('invalid');
|
|
|
+ $organizationMemberCreationRequest->method('getMobile')->willReturn($invalidMobilePhoneNumber);
|
|
|
|
|
|
$this->phoneNumberUtil
|
|
|
->expects(self::exactly(2))
|
|
|
->method('isPossibleNumber')
|
|
|
->willReturnMap([
|
|
|
- ['+33102030405', null, true],
|
|
|
- ['invalid', null, false],
|
|
|
+ [$phoneNumber, null, true],
|
|
|
+ [$invalidMobilePhoneNumber, null, false],
|
|
|
]);
|
|
|
|
|
|
$this->phoneNumberUtil
|
|
|
@@ -1761,13 +1721,14 @@ class OrganizationFactoryTest extends TestCase
|
|
|
|
|
|
$organizationMemberCreationRequest = $this->getMockBuilder(OrganizationMemberCreationRequest::class)->getMock();
|
|
|
|
|
|
- $organizationMemberCreationRequest->method('getPhone')->willReturn('+33102030405');
|
|
|
+ $phoneNumber = $this->getMockBuilder(PhoneNumber::class)->getMock();
|
|
|
+ $organizationMemberCreationRequest->method('getPhone')->willReturn($phoneNumber);
|
|
|
$organizationMemberCreationRequest->method('getMobile')->willReturn(null);
|
|
|
|
|
|
$this->phoneNumberUtil
|
|
|
->expects(self::once())
|
|
|
->method('isPossibleNumber')
|
|
|
- ->with('+33102030405')
|
|
|
+ ->with($phoneNumber)
|
|
|
->willReturn(true);
|
|
|
|
|
|
$creationDate = $this->getMockBuilder(\DateTime::class)->getMock();
|