浏览代码

refactor ShopService and Trial (bis)

Olivier Massot 5 月之前
父节点
当前提交
aa9c0ad91a

+ 1 - 1
src/Service/Shop/ShopService.php

@@ -201,7 +201,7 @@ class ShopService
         $organization = $this->createOrganization($trialRequest);
 
         // Start the artist premium trial
-        $this->trial->startArtistPremiumTrial($organization, $trialRequest);
+        $this->trial->startArtistPremiumTrialForNewStructure($organization, $trialRequest);
 
         $this->logger->info('Successfully processed NewStructureArtistPremiumTrial for token: '.$token);
     }

+ 5 - 2
src/Service/Shop/Trial.php

@@ -53,7 +53,10 @@ class Trial
      * @throws \Doctrine\DBAL\Exception
      * @throws \JsonException
      */
-    public function startArtistPremiumTrial(Organization $organization, NewStructureArtistPremiumTrialRequest $request): void
+    public function startArtistPremiumTrialForNewStructure(
+        Organization $organization,
+        NewStructureArtistPremiumTrialRequest $request
+    ): void
     {
         // Update settings
         $settings = $organization->getSettings();
@@ -95,7 +98,7 @@ class Trial
         );
 
         $this->dolibarrUtils->addActionComm(
-            $dolibarrSocietyId, 'Ouverture de la période d\'essai', $message
+            $dolibarrSocietyId, 'Ouverture de la période d\'essai (nouvelle structure)', $message
         );
     }
 }

+ 2 - 2
tests/Unit/Service/Organization/TrialTest.php

@@ -111,7 +111,7 @@ class TrialTest extends TestCase
     /**
      * Test startArtistPremiumTrial method.
      *
-     * @see Trial::startArtistPremiumTrial()
+     * @see Trial::startArtistPremiumTrialForNewStructure()
      */
     public function testStartArtistPremiumTrial(): void
     {
@@ -202,6 +202,6 @@ class TrialTest extends TestCase
                     && strpos($message, '+33123456789') !== false;
             }));
 
-        $this->trial->startArtistPremiumTrial($organization, $request);
+        $this->trial->startArtistPremiumTrialForNewStructure($organization, $request);
     }
 }

+ 1 - 1
tests/Unit/Service/Shop/ShopServiceTest.php

@@ -350,7 +350,7 @@ class ShopServiceTest extends TestCase
 
         $this->trial
             ->expects(self::once())
-            ->method('startArtistPremiumTrial')
+            ->method('startArtistPremiumTrialForNewStructure')
             ->with($organization, $trialRequest);
 
         $this->logger->expects(self::once())