Browse Source

fix unit tests and cs-fixer

Olivier Massot 1 year ago
parent
commit
385123dea1

+ 6 - 1
tests/Unit/Service/Dolibarr/DolibarrAccountCreatorTest.php

@@ -115,7 +115,12 @@ class DolibarrAccountCreatorTest extends TestCase
             ->getMock();
 
         $organizationId = 1;
-        $accountData = ['id' => '2', 'code_client' => 'C2', 'array_options' => ['options_2iopen_software_used' => 1]];
+        $accountData = [
+            'id' => '2',
+            'code_client' => 'C2',
+            'array_options' =>
+                ['2iopen_software_opentalent' => 'Opentalent Artist']
+        ];
 
         $dolibarrAccount = $dolibarrAccountCreator->createDolibarrAccount($organizationId, $accountData);
 

+ 19 - 0
tests/Unit/Service/Organization/UtilsTest.php

@@ -376,6 +376,25 @@ class UtilsTest extends TestCase
         $this->assertEquals(null, $organizationUtils->getOrganizationWebsite($organization));
     }
 
+    /**
+     * @see OrganizationUtils::getOrganizationWebsite()
+     */
+    public function testOrganizationWebsiteOutOfNetSubdomain(): void
+    {
+        $organizationUtils = $this->getOrganizationUtilsMockFor('getOrganizationWebsite');
+
+        $parameters = $this->getMockBuilder(Parameters::class)->getMock();
+        $parameters->method('getDesactivateOpentalentSiteWeb')->willReturn(false);
+        $parameters->method('getCustomDomain')->willReturn(null);
+
+        $organization = $this->getMockBuilder(Organization::class)->getMock();
+        $organization->method('getParameters')->willReturn($parameters);
+
+        $organizationUtils->method('getOrganizationActiveSubdomain')->with($organization)->willReturn('outofnet');
+
+        $this->assertEquals('https://opentalent.fr', $organizationUtils->getOrganizationWebsite($organization));
+    }
+
     /**
      * @see Utils::isLastParentAndCMF()
      */