|
|
@@ -6,6 +6,7 @@ use App\Entity\Access\Access;
|
|
|
use App\Entity\Access\FunctionType;
|
|
|
use App\Entity\Core\AddressPostal;
|
|
|
use App\Entity\Core\ContactPoint;
|
|
|
+use App\Entity\Core\Gender;
|
|
|
use App\Entity\Network\Network;
|
|
|
use App\Entity\Network\NetworkOrganization;
|
|
|
use App\Entity\Organization\Organization;
|
|
|
@@ -18,12 +19,14 @@ use App\Enum\Core\ContactPointTypeEnum;
|
|
|
use App\Enum\Network\NetworkEnum;
|
|
|
use App\Enum\Organization\AddressPostalOrganizationTypeEnum;
|
|
|
use App\Enum\Organization\SettingsProductEnum;
|
|
|
+use App\Enum\Person\GenderEnum;
|
|
|
use App\Repository\Access\AccessRepository;
|
|
|
use App\Repository\Access\FunctionTypeRepository;
|
|
|
use App\Repository\Organization\OrganizationRepository;
|
|
|
use App\Service\Core\AddressPostalUtils;
|
|
|
use App\Service\Dolibarr\DolibarrApiService;
|
|
|
use App\Service\Dolibarr\DolibarrSyncService;
|
|
|
+use App\Service\Organization\Utils;
|
|
|
use App\Service\Rest\Operation\BaseRestOperation;
|
|
|
use App\Service\Rest\Operation\CreateOperation;
|
|
|
use App\Service\Rest\Operation\DeleteOperation;
|
|
|
@@ -92,6 +95,9 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
$this->logger = $this->getMockBuilder(LoggerInterface::class)
|
|
|
->disableOriginalConstructor()
|
|
|
->getMock();
|
|
|
+ $this->organizationUtils = $this->getMockBuilder(Utils::class)
|
|
|
+ ->disableOriginalConstructor()
|
|
|
+ ->getMock();
|
|
|
|
|
|
$this->logger->method('info')->willReturnSelf();
|
|
|
$this->logger->method('debug')->willReturnSelf();
|
|
|
@@ -102,7 +108,7 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
private function getMockForMethod(string $method) {
|
|
|
$dolibarrSyncService = $this->getMockBuilder(TestableDolibarrSyncService::class)
|
|
|
->setConstructorArgs([$this->organizationRepository, $this->accessRepository, $this->functionTypeRepository,
|
|
|
- $this->dolibarrApiService, $this->addressPostalUtils, $this->arrayUtils, $this->translator])
|
|
|
+ $this->dolibarrApiService, $this->addressPostalUtils, $this->arrayUtils, $this->translator, $this->organizationUtils])
|
|
|
->setMethodsExcept([$method, 'setLoggerInterface'])
|
|
|
->getMock();
|
|
|
$dolibarrSyncService->setLoggerInterface($this->logger);
|
|
|
@@ -132,8 +138,8 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
'city' => 'ByteCity',
|
|
|
'email' => 'foo@bar.net',
|
|
|
'phone' => '0102030405',
|
|
|
- 'networkId' => NetworkEnum::CMF()->getValue(),
|
|
|
- 'product' => SettingsProductEnum::SCHOOL()->getValue()
|
|
|
+ 'networkId' => NetworkEnum::CMF->value,
|
|
|
+ 'product' => SettingsProductEnum::SCHOOL
|
|
|
];
|
|
|
|
|
|
$orgId2 = 20;
|
|
|
@@ -145,7 +151,7 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
'email' => null,
|
|
|
'phone' => null,
|
|
|
'networkId' => null,
|
|
|
- 'product' => SettingsProductEnum::ARTIST()->getValue()
|
|
|
+ 'product' => SettingsProductEnum::ARTIST
|
|
|
];
|
|
|
|
|
|
$orgId3 = 30;
|
|
|
@@ -163,7 +169,7 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
$personData1 = [
|
|
|
'name' => 'Dupont',
|
|
|
'givenName' => 'Hercules',
|
|
|
- 'gender' => 'Mr',
|
|
|
+ 'gender' => GenderEnum::MISTER,
|
|
|
'email' => 'an@email.net',
|
|
|
'phone' => '0102030405',
|
|
|
'mobilePhone' => '0607080910',
|
|
|
@@ -186,13 +192,13 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
];
|
|
|
|
|
|
$activeMembers1 = [
|
|
|
- $accessId1 => [FunctionEnum::PRESIDENT()->getValue()],
|
|
|
- $accessId3 => [FunctionEnum::STUDENT()->getValue()],
|
|
|
- $accessId5 => [FunctionEnum::TREASURER()->getValue()]
|
|
|
+ $accessId1 => [FunctionEnum::PRESIDENT->value],
|
|
|
+ $accessId3 => [FunctionEnum::STUDENT->value],
|
|
|
+ $accessId5 => [FunctionEnum::TREASURER->value]
|
|
|
];
|
|
|
|
|
|
$activeMembers2 = [
|
|
|
- $accessId2 => [FunctionEnum::PRESIDENT()->getValue()]
|
|
|
+ $accessId2 => [FunctionEnum::PRESIDENT->value]
|
|
|
];
|
|
|
|
|
|
|
|
|
@@ -279,9 +285,9 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
['STUDENTS_COUNT', [], null, null, "Nombre d'élèves"],
|
|
|
['ADHERENTS_COUNT', [], null, null, "Nombre d'adhérents"],
|
|
|
['ADMIN_ACCESS_COUNT', [], null, null, "Nombre d'accès admin"],
|
|
|
- ['school', [], null, null, 'Opentalent School'],
|
|
|
- ['artist', [], null, null, 'Opentalent Artist'],
|
|
|
- ['Mr', [], null, null, 'MR'],
|
|
|
+ [SettingsProductEnum::SCHOOL->value, [], null, null, 'Opentalent School'],
|
|
|
+ [SettingsProductEnum::ARTIST->value, [], null, null, 'Opentalent Artist'],
|
|
|
+ [GenderEnum::MISTER->value, [], null, null, 'MR'],
|
|
|
]);
|
|
|
|
|
|
// Get societies
|
|
|
@@ -312,13 +318,13 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
|
|
|
// Function types
|
|
|
$functionType1 = $this->getMockBuilder(FunctionType::class)->getMock();
|
|
|
- $functionType1->method('getMission')->willReturn(FunctionEnum::DIRECTOR()->getValue());
|
|
|
+ $functionType1->method('getMission')->willReturn(FunctionEnum::DIRECTOR);
|
|
|
$functionType2 = $this->getMockBuilder(FunctionType::class)->getMock();
|
|
|
- $functionType2->method('getMission')->willReturn(FunctionEnum::PRESIDENT()->getValue());
|
|
|
+ $functionType2->method('getMission')->willReturn(FunctionEnum::PRESIDENT);
|
|
|
$this->functionTypeRepository
|
|
|
->expects($this->once())
|
|
|
->method('findBy')
|
|
|
- ->with(['roleByDefault' => RoleEnum::ROLE_ADMIN()->getValue()])
|
|
|
+ ->with(['roleByDefault' => RoleEnum::ROLE_ADMIN])
|
|
|
->willReturn([$functionType1, $functionType2]);
|
|
|
|
|
|
// Get CMF and FFEC ids
|
|
|
@@ -383,14 +389,24 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
$organization1->method('getSettings')->willReturn($settings1);
|
|
|
|
|
|
$settings2 = $this->getMockBuilder(Settings::class)->getMock();
|
|
|
- $settings1->method('getProduct')->willReturn($organizationData2['product']);
|
|
|
+ $settings2->method('getProduct')->willReturn($organizationData2['product']);
|
|
|
$organization2->method('getSettings')->willReturn($settings2);
|
|
|
|
|
|
+ $this->organizationUtils->method('isSchool')->willReturnMap([
|
|
|
+ [$organization1, true],
|
|
|
+ [$organization2, false]
|
|
|
+ ]);
|
|
|
+ $this->organizationUtils->method('isArtist')->willReturnMap([
|
|
|
+ [$organization1, false],
|
|
|
+ [$organization2, true]
|
|
|
+ ]);
|
|
|
+
|
|
|
$dolibarrSyncService->method('countWithMission')->willReturnMap([
|
|
|
- [[FunctionEnum::STUDENT()->getValue()], $activeMembers1, 1],
|
|
|
- [[FunctionEnum::ADHERENT()->getValue()], $activeMembers1, 2],
|
|
|
- [[FunctionEnum::DIRECTOR()->getValue(), FunctionEnum::PRESIDENT()->getValue()], $activeMembers1, 1],
|
|
|
- [[FunctionEnum::DIRECTOR()->getValue(), FunctionEnum::PRESIDENT()->getValue()], $activeMembers2, 2]
|
|
|
+ [[FunctionEnum::STUDENT->value], $activeMembers1, 1],
|
|
|
+ [[FunctionEnum::ADHERENT->value], $activeMembers1, 2],
|
|
|
+ [[FunctionEnum::ADHERENT->value], $activeMembers2, 0],
|
|
|
+ [[FunctionEnum::DIRECTOR->value, FunctionEnum::PRESIDENT->value], $activeMembers1, 1],
|
|
|
+ [[FunctionEnum::DIRECTOR->value, FunctionEnum::PRESIDENT->value], $activeMembers2, 2]
|
|
|
]);
|
|
|
|
|
|
$this->arrayUtils
|
|
|
@@ -475,8 +491,8 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
]);
|
|
|
|
|
|
$dolibarrSyncService->method('formatContactPosition')->willReturnMap([
|
|
|
- [[FunctionEnum::PRESIDENT()->getValue()], 'Mr', 'Président'],
|
|
|
- [[FunctionEnum::PRESIDENT()->getValue()], null, 'Président(e)'],
|
|
|
+ [[FunctionEnum::PRESIDENT->value], GenderEnum::MISTER->value, 'Président'],
|
|
|
+ [[FunctionEnum::PRESIDENT->value], null, 'Président(e)'],
|
|
|
]);
|
|
|
|
|
|
// Expected logged error messages
|
|
|
@@ -548,7 +564,8 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
'status : (new) => `1`',
|
|
|
'town : (new) => ``',
|
|
|
'zip : (new) => ``',
|
|
|
- 'array_options.options_2iopeninfoopentalent : (new) => `Nombre d\'accès admin : 2`',
|
|
|
+ 'array_options.options_2iopen_software_opentalent : (new) => `Opentalent Artist`',
|
|
|
+ "array_options.options_2iopeninfoopentalent : (new) => `Nombre d'adhérents : 0\nNombre d'accès admin : 2`",
|
|
|
],
|
|
|
$operations[3]->getChangeLog()
|
|
|
);
|
|
|
@@ -686,18 +703,18 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
->method('getAllActiveMembersAndMissions')
|
|
|
->willReturn(
|
|
|
[
|
|
|
- ['id' => 1, 'organization_id' => 1, 'mission' => FunctionEnum::PRESIDENT()->getValue()],
|
|
|
- ['id' => 2, 'organization_id' => 1, 'mission' => FunctionEnum::STUDENT()->getValue()],
|
|
|
- ['id' => 3, 'organization_id' => 2, 'mission' => FunctionEnum::PRESIDENT()->getValue()],
|
|
|
- ['id' => 3, 'organization_id' => 2, 'mission' => FunctionEnum::TEACHER()->getValue()]
|
|
|
+ ['id' => 1, 'organization_id' => 1, 'mission' => FunctionEnum::PRESIDENT],
|
|
|
+ ['id' => 2, 'organization_id' => 1, 'mission' => FunctionEnum::STUDENT],
|
|
|
+ ['id' => 3, 'organization_id' => 2, 'mission' => FunctionEnum::PRESIDENT],
|
|
|
+ ['id' => 3, 'organization_id' => 2, 'mission' => FunctionEnum::TEACHER]
|
|
|
]
|
|
|
);
|
|
|
|
|
|
$index = $dolibarrSyncService->getActiveMembersIndex();
|
|
|
|
|
|
$this->assertEqualsCanonicalizing([
|
|
|
- 1 => [1 => [FunctionEnum::PRESIDENT()->getValue()], 2 => [FunctionEnum::STUDENT()->getValue()]],
|
|
|
- 2 => [3 => [FunctionEnum::PRESIDENT()->getValue(), FunctionEnum::TEACHER()->getValue()]]
|
|
|
+ 1 => [1 => [FunctionEnum::PRESIDENT], 2 => [FunctionEnum::STUDENT]],
|
|
|
+ 2 => [3 => [FunctionEnum::PRESIDENT, FunctionEnum::TEACHER]]
|
|
|
], $index);
|
|
|
}
|
|
|
|
|
|
@@ -830,9 +847,9 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
$organizationAddressPostal3 = $this->getMockBuilder(OrganizationAddressPostal::class)->getMock();
|
|
|
$addressPostal = $this->getMockBuilder(AddressPostal::class)->getMock();
|
|
|
|
|
|
- $organizationAddressPostal1->method('getType')->willReturn(AddressPostalOrganizationTypeEnum::ADDRESS_PRACTICE()->getValue());
|
|
|
- $organizationAddressPostal2->method('getType')->willReturn(AddressPostalOrganizationTypeEnum::ADDRESS_BILL()->getValue());
|
|
|
- $organizationAddressPostal3->method('getType')->willReturn(AddressPostalOrganizationTypeEnum::ADDRESS_OTHER()->getValue());
|
|
|
+ $organizationAddressPostal1->method('getType')->willReturn(AddressPostalOrganizationTypeEnum::ADDRESS_PRACTICE);
|
|
|
+ $organizationAddressPostal2->method('getType')->willReturn(AddressPostalOrganizationTypeEnum::ADDRESS_BILL);
|
|
|
+ $organizationAddressPostal3->method('getType')->willReturn(AddressPostalOrganizationTypeEnum::ADDRESS_OTHER);
|
|
|
|
|
|
$organizationAddressPostal2->method('getAddressPostal')->willReturn($addressPostal);
|
|
|
|
|
|
@@ -877,9 +894,9 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
$contactPoint2 = $this->getMockBuilder(ContactPoint::class)->getMock();
|
|
|
$contactPoint3 = $this->getMockBuilder(ContactPoint::class)->getMock();
|
|
|
|
|
|
- $contactPoint1->method('getContactType')->willReturn(ContactPointTypeEnum::OTHER()->getValue());
|
|
|
- $contactPoint2->method('getContactType')->willReturn(ContactPointTypeEnum::BILL()->getValue());
|
|
|
- $contactPoint3->method('getContactType')->willReturn(ContactPointTypeEnum::PRINCIPAL()->getValue());
|
|
|
+ $contactPoint1->method('getContactType')->willReturn(ContactPointTypeEnum::OTHER);
|
|
|
+ $contactPoint2->method('getContactType')->willReturn(ContactPointTypeEnum::BILL);
|
|
|
+ $contactPoint3->method('getContactType')->willReturn(ContactPointTypeEnum::PRINCIPAL);
|
|
|
|
|
|
$phone = $this->getMockBuilder(PhoneNumber::class)->disableOriginalConstructor()->getMock();
|
|
|
$contactPoint2->method('getTelphone')->willReturn($phone);
|
|
|
@@ -911,9 +928,9 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
$contactPoint2 = $this->getMockBuilder(ContactPoint::class)->getMock();
|
|
|
$contactPoint3 = $this->getMockBuilder(ContactPoint::class)->getMock();
|
|
|
|
|
|
- $contactPoint1->method('getContactType')->willReturn(ContactPointTypeEnum::OTHER()->getValue());
|
|
|
- $contactPoint2->method('getContactType')->willReturn(ContactPointTypeEnum::BILL()->getValue());
|
|
|
- $contactPoint3->method('getContactType')->willReturn(ContactPointTypeEnum::PRINCIPAL()->getValue());
|
|
|
+ $contactPoint1->method('getContactType')->willReturn(ContactPointTypeEnum::OTHER);
|
|
|
+ $contactPoint2->method('getContactType')->willReturn(ContactPointTypeEnum::BILL);
|
|
|
+ $contactPoint3->method('getContactType')->willReturn(ContactPointTypeEnum::PRINCIPAL);
|
|
|
|
|
|
$contactPoint2->expects($this->once())->method('getTelphone')->willReturn(null);
|
|
|
|
|
|
@@ -966,9 +983,9 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
$contactPoint2 = $this->getMockBuilder(ContactPoint::class)->getMock();
|
|
|
$contactPoint3 = $this->getMockBuilder(ContactPoint::class)->getMock();
|
|
|
|
|
|
- $contactPoint1->method('getContactType')->willReturn(ContactPointTypeEnum::OTHER()->getValue());
|
|
|
- $contactPoint2->method('getContactType')->willReturn(ContactPointTypeEnum::BILL()->getValue());
|
|
|
- $contactPoint3->method('getContactType')->willReturn(ContactPointTypeEnum::PRINCIPAL()->getValue());
|
|
|
+ $contactPoint1->method('getContactType')->willReturn(ContactPointTypeEnum::OTHER);
|
|
|
+ $contactPoint2->method('getContactType')->willReturn(ContactPointTypeEnum::BILL);
|
|
|
+ $contactPoint3->method('getContactType')->willReturn(ContactPointTypeEnum::PRINCIPAL);
|
|
|
|
|
|
$contactPoint2->method('getEmail')->willReturn('email@email.com');
|
|
|
|
|
|
@@ -1079,33 +1096,33 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
$dolibarrSyncService = $this->getMockForMethod('countWithMission');
|
|
|
|
|
|
$members = [
|
|
|
- 123 => [FunctionEnum::PRESIDENT()->getValue(), FunctionEnum::TEACHER()->getValue()],
|
|
|
- 124 => [FunctionEnum::TEACHER()->getValue()],
|
|
|
- 125 => [FunctionEnum::STUDENT()->getValue()],
|
|
|
- 126 => [FunctionEnum::TREASURER()->getValue()],
|
|
|
+ 123 => [FunctionEnum::PRESIDENT->value, FunctionEnum::TEACHER->value],
|
|
|
+ 124 => [FunctionEnum::TEACHER->value],
|
|
|
+ 125 => [FunctionEnum::STUDENT->value],
|
|
|
+ 126 => [FunctionEnum::TREASURER->value],
|
|
|
];
|
|
|
|
|
|
$this->assertEquals(
|
|
|
2,
|
|
|
- $dolibarrSyncService->countWithMission([FunctionEnum::TEACHER()->getValue()], $members)
|
|
|
+ $dolibarrSyncService->countWithMission([FunctionEnum::TEACHER->value], $members)
|
|
|
);
|
|
|
|
|
|
$this->assertEquals(
|
|
|
3,
|
|
|
$dolibarrSyncService->countWithMission(
|
|
|
- [FunctionEnum::TEACHER()->getValue(), FunctionEnum::TREASURER()->getValue()],
|
|
|
+ [FunctionEnum::TEACHER->value, FunctionEnum::TREASURER->value],
|
|
|
$members
|
|
|
)
|
|
|
);
|
|
|
|
|
|
$this->assertEquals(
|
|
|
1,
|
|
|
- $dolibarrSyncService->countWithMission([FunctionEnum::STUDENT()->getValue()], $members)
|
|
|
+ $dolibarrSyncService->countWithMission([FunctionEnum::STUDENT->value], $members)
|
|
|
);
|
|
|
|
|
|
$this->assertEquals(
|
|
|
0,
|
|
|
- $dolibarrSyncService->countWithMission([FunctionEnum::ARCHIVIST()->getValue()], $members)
|
|
|
+ $dolibarrSyncService->countWithMission([FunctionEnum::ARCHIVIST->value], $members)
|
|
|
);
|
|
|
}
|
|
|
|
|
|
@@ -1120,8 +1137,8 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
$contactPoint1 = $this->getMockBuilder(ContactPoint::class)->getMock();
|
|
|
$contactPoint2 = $this->getMockBuilder(ContactPoint::class)->getMock();
|
|
|
|
|
|
- $contactPoint1->method('getContactType')->willReturn(ContactPointTypeEnum::OTHER()->getValue());
|
|
|
- $contactPoint2->method('getContactType')->willReturn(ContactPointTypeEnum::PRINCIPAL()->getValue());
|
|
|
+ $contactPoint1->method('getContactType')->willReturn(ContactPointTypeEnum::OTHER);
|
|
|
+ $contactPoint2->method('getContactType')->willReturn(ContactPointTypeEnum::PRINCIPAL);
|
|
|
|
|
|
$person->expects($this->once())->method('getContactPoints')->willReturn(new ArrayCollection([$contactPoint1, $contactPoint2]));
|
|
|
|
|
|
@@ -1147,38 +1164,38 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
|
|
|
$this->translator->method('trans')->willReturnMap(
|
|
|
[
|
|
|
- [FunctionEnum::PRESIDENT()->getValue(), ['gender' => 'X'], null, null, 'Président(e)'],
|
|
|
- [FunctionEnum::PRESIDENT()->getValue(), ['gender' => 'M'], null, null, 'Président'],
|
|
|
- [FunctionEnum::PRESIDENT()->getValue(), ['gender' => 'F'], null, null, 'Présidente'],
|
|
|
- [FunctionEnum::DIRECTOR()->getValue(), ['gender' => 'X'], null, null, 'Directeur(ice)'],
|
|
|
- [FunctionEnum::DIRECTOR()->getValue(), ['gender' => 'M'], null, null, 'Directeur'],
|
|
|
- [FunctionEnum::DIRECTOR()->getValue(), ['gender' => 'F'], null, null, 'Directrice'],
|
|
|
- [FunctionEnum::TEACHER()->getValue(), ['gender' => 'X'], null, null, 'Professeur(e)'],
|
|
|
- [FunctionEnum::ARCHIVIST()->getValue(), ['gender' => 'X'], null, null, 'Archiviste'],
|
|
|
- [FunctionEnum::TREASURER()->getValue(), ['gender' => 'X'], null, null, 'Trésorier(ère)'],
|
|
|
- [FunctionEnum::ADMINISTRATIVE_STAFF()->getValue(), ['gender' => 'X'], null, null, 'Personnel administratif'],
|
|
|
+ [FunctionEnum::PRESIDENT->value, ['gender' => 'X'], null, null, 'Président(e)'],
|
|
|
+ [FunctionEnum::PRESIDENT->value, ['gender' => 'M'], null, null, 'Président'],
|
|
|
+ [FunctionEnum::PRESIDENT->value, ['gender' => 'F'], null, null, 'Présidente'],
|
|
|
+ [FunctionEnum::DIRECTOR->value, ['gender' => 'X'], null, null, 'Directeur(ice)'],
|
|
|
+ [FunctionEnum::DIRECTOR->value, ['gender' => 'M'], null, null, 'Directeur'],
|
|
|
+ [FunctionEnum::DIRECTOR->value, ['gender' => 'F'], null, null, 'Directrice'],
|
|
|
+ [FunctionEnum::TEACHER->value, ['gender' => 'X'], null, null, 'Professeur(e)'],
|
|
|
+ [FunctionEnum::ARCHIVIST->value, ['gender' => 'X'], null, null, 'Archiviste'],
|
|
|
+ [FunctionEnum::TREASURER->value, ['gender' => 'X'], null, null, 'Trésorier(ère)'],
|
|
|
+ [FunctionEnum::ADMINISTRATIVE_STAFF->value, ['gender' => 'X'], null, null, 'Personnel administratif'],
|
|
|
]
|
|
|
);
|
|
|
|
|
|
$this->assertEquals(
|
|
|
'Président(e)',
|
|
|
- $dolibarrSyncService->formatContactPosition([FunctionEnum::PRESIDENT()->getValue()])
|
|
|
+ $dolibarrSyncService->formatContactPosition([FunctionEnum::PRESIDENT->value])
|
|
|
);
|
|
|
|
|
|
$this->assertEquals(
|
|
|
'Président',
|
|
|
- $dolibarrSyncService->formatContactPosition([FunctionEnum::PRESIDENT()->getValue()], 'MISTER')
|
|
|
+ $dolibarrSyncService->formatContactPosition([FunctionEnum::PRESIDENT->value], 'MISTER')
|
|
|
);
|
|
|
|
|
|
$this->assertEquals(
|
|
|
'Présidente',
|
|
|
- $dolibarrSyncService->formatContactPosition([FunctionEnum::PRESIDENT()->getValue()], 'MISS')
|
|
|
+ $dolibarrSyncService->formatContactPosition([FunctionEnum::PRESIDENT->value], 'MISS')
|
|
|
);
|
|
|
|
|
|
$this->assertEquals(
|
|
|
'Présidente, Directrice',
|
|
|
$dolibarrSyncService->formatContactPosition(
|
|
|
- [FunctionEnum::PRESIDENT()->getValue(), FunctionEnum::DIRECTOR()->getValue()],
|
|
|
+ [FunctionEnum::PRESIDENT->value, FunctionEnum::DIRECTOR->value],
|
|
|
'MISS'
|
|
|
)
|
|
|
);
|
|
|
@@ -1186,7 +1203,7 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
$this->assertEquals(
|
|
|
'Président, Directeur',
|
|
|
$dolibarrSyncService->formatContactPosition(
|
|
|
- [FunctionEnum::PRESIDENT()->getValue(), FunctionEnum::DIRECTOR()->getValue(), FunctionEnum::ADHERENT()->getValue()],
|
|
|
+ [FunctionEnum::PRESIDENT->value, FunctionEnum::DIRECTOR->value, FunctionEnum::ADHERENT->value],
|
|
|
'MISTER'
|
|
|
)
|
|
|
);
|
|
|
@@ -1194,7 +1211,7 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
$this->assertEquals(
|
|
|
'Président, Directeur',
|
|
|
$dolibarrSyncService->formatContactPosition(
|
|
|
- [FunctionEnum::PRESIDENT()->getValue(), FunctionEnum::DIRECTOR()->getValue(), FunctionEnum::ADHERENT()->getValue()],
|
|
|
+ [FunctionEnum::PRESIDENT->value, FunctionEnum::DIRECTOR->value, FunctionEnum::ADHERENT->value],
|
|
|
'MISTER'
|
|
|
)
|
|
|
);
|
|
|
@@ -1203,12 +1220,12 @@ class DolibarrSyncServiceTest extends TestCase
|
|
|
'Président(e), Directeur(ice), Professeur(e), Archiviste, Trésorier(ère), Pers...',
|
|
|
$dolibarrSyncService->formatContactPosition(
|
|
|
[
|
|
|
- FunctionEnum::PRESIDENT()->getValue(),
|
|
|
- FunctionEnum::DIRECTOR()->getValue(),
|
|
|
- FunctionEnum::TEACHER()->getValue(),
|
|
|
- FunctionEnum::ARCHIVIST()->getValue(),
|
|
|
- FunctionEnum::TREASURER()->getValue(),
|
|
|
- FunctionEnum::ADMINISTRATIVE_STAFF()->getValue(),
|
|
|
+ FunctionEnum::PRESIDENT->value,
|
|
|
+ FunctionEnum::DIRECTOR->value,
|
|
|
+ FunctionEnum::TEACHER->value,
|
|
|
+ FunctionEnum::ARCHIVIST->value,
|
|
|
+ FunctionEnum::TREASURER->value,
|
|
|
+ FunctionEnum::ADMINISTRATIVE_STAFF->value,
|
|
|
],
|
|
|
'X'
|
|
|
)
|