|
|
@@ -5,6 +5,7 @@ namespace App\Tests\Unit\Service\Typo3;
|
|
|
|
|
|
use App\Entity\Access\Access;
|
|
|
use App\Entity\Organization\Organization;
|
|
|
+use App\Entity\Organization\Parameters;
|
|
|
use App\Entity\Organization\Subdomain;
|
|
|
use App\Entity\Person\Person;
|
|
|
use App\Message\Command\MailerCommand;
|
|
|
@@ -164,18 +165,23 @@ class SubdomainServiceTest extends TestCase
|
|
|
public function testAddNewSubdomain(): void {
|
|
|
$subdomainService = $this->makeSubdomainServiceMockFor('addNewSubdomain');
|
|
|
|
|
|
+ $parameters = $this->getMockBuilder(Parameters::class)->disableOriginalConstructor()->getMock();
|
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
|
+ $organization->method('getParameters')->willReturn($parameters);
|
|
|
|
|
|
$subdomainService->expects(self::once())->method('isValidSubdomain')->with('sub')->willReturn(True);
|
|
|
$subdomainService->expects(self::once())->method('canRegisterNewSubdomain')->with($organization)->willReturn(True);
|
|
|
$subdomainService->expects(self::once())->method('isReservedSubdomain')->with('sub')->willReturn(false);
|
|
|
$subdomainService->expects(self::once())->method('isRegistered')->with('sub')->willReturn(false);
|
|
|
|
|
|
- $this->entityManager->expects(self::once())->method('persist');
|
|
|
+ $this->entityManager->expects(self::exactly(2))->method('persist');
|
|
|
$this->entityManager->expects(self::once())->method('flush');
|
|
|
|
|
|
$this->bindFileService->expects(self::once())->method('registerSubdomain')->with('sub');
|
|
|
|
|
|
+ $parameters->expects(self::once())->method('setSubDomain')->with('sub');
|
|
|
+ $parameters->expects(self::once())->method('setOtherWebsite')->with('https://sub.opentalent.fr');
|
|
|
+
|
|
|
// Subdomain is not activated by default
|
|
|
$subdomainService->expects(self::never())->method('activateSubdomain');
|
|
|
|