Explorar el Código

fix unit tests

Olivier Massot hace 2 años
padre
commit
98092701ea
Se han modificado 1 ficheros con 14 adiciones y 2 borrados
  1. 14 2
      tests/Unit/Service/Typo3/SubdomainServiceTest.php

+ 14 - 2
tests/Unit/Service/Typo3/SubdomainServiceTest.php

@@ -295,12 +295,19 @@ class SubdomainServiceTest extends TestCase
 
         $organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
 
+        $previousActiveSubdomain = $this->getMockBuilder(Subdomain::class)->getMock();
+        $previousActiveSubdomain->method('getId')->willReturn(1);
+        $previousActiveSubdomain->method('isActive')->willReturn(false);
+
+        $this->subdomainRepository->method('getActiveSubdomainOf')->with($organization)->willReturn($previousActiveSubdomain);
+
         $initialSubdomain = $this->getMockBuilder(Subdomain::class)->getMock();
-        $initialSubdomain->method('getId')->willReturn(1);
+        $initialSubdomain->method('getId')->willReturn(2);
         $initialSubdomain->method('isActive')->willReturn(false);
+        $initialSubdomain->method('getOrganization')->willReturn($organization);
 
         $activatedSubdomain = $this->getMockBuilder(Subdomain::class)->getMock();
-        $activatedSubdomain->method('getId')->willReturn(1);
+        $activatedSubdomain->method('getId')->willReturn(2);
         $activatedSubdomain->method('isActive')->willReturn(true);
         $activatedSubdomain->method('getOrganization')->willReturn($organization);
 
@@ -334,10 +341,15 @@ class SubdomainServiceTest extends TestCase
     {
         $subdomainService = $this->makeSubdomainServiceMockFor('activateSubdomain');
 
+        $organization = $this->getMockBuilder(Organization::class)->getMock();
+
         $subdomain = $this->getMockBuilder(Subdomain::class)->getMock();
+        $subdomain->method('getOrganization')->willReturn($organization);
         $subdomain->method('getId')->willReturn(1);
         $subdomain->method('isActive')->willReturn(true);
 
+        $this->subdomainRepository->method('getActiveSubdomainOf')->with($organization)->willReturn($subdomain);
+
         $subdomainService->expects(self::never())->method('setOrganizationActiveSubdomain');
         $subdomainService->expects(self::never())->method('renameAdminUserToMatchSubdomain');
         $subdomainService->expects(self::never())->method('updateTypo3Website');