|
@@ -127,9 +127,9 @@ class TestableOrganizationFactory extends OrganizationFactory {
|
|
|
parent::deleteTypo3Website($organization);
|
|
parent::deleteTypo3Website($organization);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function deleteDolibarrSociety(Organization $organization): void
|
|
|
|
|
|
|
+ public function switchDolibarrSocietyToProspect(Organization $organization): void
|
|
|
{
|
|
{
|
|
|
- parent::deleteDolibarrSociety($organization);
|
|
|
|
|
|
|
+ parent::switchDolibarrSocietyToProspect($organization);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function deleteLocalDirectories(Organization $organization): void
|
|
public function deleteLocalDirectories(Organization $organization): void
|
|
@@ -1291,6 +1291,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
|
|
|
|
|
$parameters = $this->getMockBuilder(Parameters::class)->getMock();
|
|
$parameters = $this->getMockBuilder(Parameters::class)->getMock();
|
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
|
|
|
+ $organization->method('getId')->willReturn(123);
|
|
|
$organization->method('getParameters')->willReturn($parameters);
|
|
$organization->method('getParameters')->willReturn($parameters);
|
|
|
|
|
|
|
|
$this->organizationRepository
|
|
$this->organizationRepository
|
|
@@ -1312,7 +1313,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
$organizationFactory->expects(self::once())->method('deleteTypo3Website')->with($organization);
|
|
$organizationFactory->expects(self::once())->method('deleteTypo3Website')->with($organization);
|
|
|
- $organizationFactory->expects(self::once())->method('deleteDolibarrSociety')->with($organization);
|
|
|
|
|
|
|
+ $organizationFactory->expects(self::once())->method('switchDolibarrSocietyToProspect')->with($organization);
|
|
|
$organizationFactory->expects(self::once())->method('deleteLocalDirectories')->with($organization);
|
|
$organizationFactory->expects(self::once())->method('deleteLocalDirectories')->with($organization);
|
|
|
$organizationFactory->expects(self::once())->method('deleteDirectoriesV1')->with($organization);
|
|
$organizationFactory->expects(self::once())->method('deleteDirectoriesV1')->with($organization);
|
|
|
$organizationFactory->expects(self::once())->method('deleteDirectories59')->with($organization);
|
|
$organizationFactory->expects(self::once())->method('deleteDirectories59')->with($organization);
|
|
@@ -1358,7 +1359,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
$this->entityManager->method('remove')->willThrowException(new \Exception('some error'));
|
|
$this->entityManager->method('remove')->willThrowException(new \Exception('some error'));
|
|
|
|
|
|
|
|
$organizationFactory->expects(self::never())->method('deleteTypo3Website');
|
|
$organizationFactory->expects(self::never())->method('deleteTypo3Website');
|
|
|
- $organizationFactory->expects(self::never())->method('deleteDolibarrSociety');
|
|
|
|
|
|
|
+ $organizationFactory->expects(self::never())->method('switchDolibarrSocietyToProspect');
|
|
|
$organizationFactory->expects(self::never())->method('deleteLocalDirectories');
|
|
$organizationFactory->expects(self::never())->method('deleteLocalDirectories');
|
|
|
$organizationFactory->expects(self::never())->method('deleteDirectoriesV1');
|
|
$organizationFactory->expects(self::never())->method('deleteDirectoriesV1');
|
|
|
$organizationFactory->expects(self::never())->method('deleteDirectories59');
|
|
$organizationFactory->expects(self::never())->method('deleteDirectories59');
|
|
@@ -1389,6 +1390,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
|
|
|
|
|
$parameters = $this->getMockBuilder(Parameters::class)->getMock();
|
|
$parameters = $this->getMockBuilder(Parameters::class)->getMock();
|
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
|
|
|
+ $organization->method('getId')->willReturn(123);
|
|
|
$organization->method('getParameters')->willReturn($parameters);
|
|
$organization->method('getParameters')->willReturn($parameters);
|
|
|
|
|
|
|
|
$this->organizationRepository
|
|
$this->organizationRepository
|
|
@@ -1410,7 +1412,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
$organizationFactory->expects(self::once())->method('deleteTypo3Website')->willThrowException(new \Exception('some error'));
|
|
$organizationFactory->expects(self::once())->method('deleteTypo3Website')->willThrowException(new \Exception('some error'));
|
|
|
- $organizationFactory->expects(self::once())->method('deleteDolibarrSociety')->willThrowException(new \Exception('some error'));
|
|
|
|
|
|
|
+ $organizationFactory->expects(self::once())->method('switchDolibarrSocietyToProspect')->willThrowException(new \Exception('some error'));
|
|
|
$organizationFactory->expects(self::once())->method('deleteLocalDirectories')->willThrowException(new \Exception('some error'));
|
|
$organizationFactory->expects(self::once())->method('deleteLocalDirectories')->willThrowException(new \Exception('some error'));
|
|
|
$organizationFactory->expects(self::once())->method('deleteDirectoriesV1')->willThrowException(new \Exception('some error'));
|
|
$organizationFactory->expects(self::once())->method('deleteDirectoriesV1')->willThrowException(new \Exception('some error'));
|
|
|
$organizationFactory->expects(self::once())->method('deleteDirectories59')->willThrowException(new \Exception('some error'));
|
|
$organizationFactory->expects(self::once())->method('deleteDirectories59')->willThrowException(new \Exception('some error'));
|
|
@@ -1425,7 +1427,7 @@ class OrganizationFactoryTest extends TestCase
|
|
|
->method('critical')
|
|
->method('critical')
|
|
|
->withConsecutive(
|
|
->withConsecutive(
|
|
|
["An error happened while deleting the Typo3 website, please proceed manually."],
|
|
["An error happened while deleting the Typo3 website, please proceed manually."],
|
|
|
- ["An error happened while deleting the Dolibarr society, please proceed manually."],
|
|
|
|
|
|
|
+ ["An error happened while updating the Dolibarr society, please proceed manually."],
|
|
|
["An error happened while deleting the local directories, please proceed manually."],
|
|
["An error happened while deleting the local directories, please proceed manually."],
|
|
|
["An error happened while deleting the V1 directories, please proceed manually."],
|
|
["An error happened while deleting the V1 directories, please proceed manually."],
|
|
|
["An error happened while deleting the 5.9 directories, please proceed manually."],
|
|
["An error happened while deleting the 5.9 directories, please proceed manually."],
|
|
@@ -1469,4 +1471,19 @@ class OrganizationFactoryTest extends TestCase
|
|
|
|
|
|
|
|
$organizationFactory->deleteOrganizationAccesses($organization);
|
|
$organizationFactory->deleteOrganizationAccesses($organization);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public function testSwitchDolibarrSocietyToProspect(): void
|
|
|
|
|
+ {
|
|
|
|
|
+ $organizationFactory = $this->getOrganizationFactoryMockFor('switchDolibarrSocietyToProspect');
|
|
|
|
|
+
|
|
|
|
|
+ $organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
|
|
|
+ $organization->method('getId')->willReturn(123);
|
|
|
|
|
+
|
|
|
|
|
+ $this->dolibarrApiService
|
|
|
|
|
+ ->expects(self::once())
|
|
|
|
|
+ ->method('switchSocietyToProspect')
|
|
|
|
|
+ ->with(123);
|
|
|
|
|
+
|
|
|
|
|
+ $organizationFactory->switchDolibarrSocietyToProspect($organization);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|