소스 검색

Merge branch 'feature/various_fixes' into develop

Olivier Massot 2 년 전
부모
커밋
015d50d070

+ 2 - 2
src/Entity/Access/Access.php

@@ -407,7 +407,7 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
     }
 
     /**
-     * @return array<bool|string>
+     * @return array<mixed>
      */
     public function getHistorical(): array
     {
@@ -416,7 +416,7 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
 
 
     /**
-     * @param array<bool|string> $historical
+     * @param array<mixed> $historical
      * @return $this
      */
     #[Groups(['my_access:input'])]

+ 1 - 1
src/Entity/Message/AbstractMessage.php

@@ -110,4 +110,4 @@ abstract class AbstractMessage
     {
         return $this->dateSent;
     }
-}
+}

+ 1 - 1
src/Entity/Message/AbstractReport.php

@@ -16,7 +16,7 @@ use Doctrine\ORM\Mapping as ORM;
 #[ORM\MappedSuperclass]
 class AbstractReport
 {
-    #[ORM\Column(type: 'date', nullable: true)]
+    #[ORM\Column(type: 'datetime', nullable: true)]
     protected ?\DatetimeInterface $dateSend;
 
     #[ORM\Column(length: 255)]

+ 3 - 1
src/Entity/Message/Email.php

@@ -3,6 +3,7 @@ declare(strict_types=1);
 
 namespace App\Entity\Message;
 
+use ApiPlatform\Metadata\ApiResource;
 use App\Entity\Access\Access;
 use App\Entity\Core\File;
 use App\Entity\Core\Tagg;
@@ -19,6 +20,7 @@ use Ramsey\Uuid\Uuid;
  * Classe ... qui ...
  */
 //#[Auditable]
+#[ApiResource(operations: [])]
 #[ORM\Table(name: 'Message')]
 #[ORM\Entity]
 class Email extends AbstractMessage
@@ -185,4 +187,4 @@ class Email extends AbstractMessage
 
         return $this;
     }
-}
+}

+ 13 - 13
src/Entity/Message/ReportSms.php

@@ -23,8 +23,8 @@ class ReportSms extends AbstractReport
     #[ORM\JoinColumn('message_id')]
     private Sms $sms;
 
-    #[ORM\Column(length: 255)]
-    private string $mobile;
+//    #[ORM\Column(length: 255)]
+//    private string $mobile;
 
     #[ORM\Column(nullable: true)]
     private ?string $smsId;
@@ -46,16 +46,16 @@ class ReportSms extends AbstractReport
         return $this;
     }
 
-    public function setMobile(string $mobile): self
-    {
-        $this->mobile = $mobile;
-        return $this;
-    }
-
-    public function getMobile(): string
-    {
-        return $this->mobile;
-    }
+//    public function setMobile(string $mobile): self
+//    {
+//        $this->mobile = $mobile;
+//        return $this;
+//    }
+//
+//    public function getMobile(): string
+//    {
+//        return $this->mobile;
+//    }
 
     public function setSmsId(string $smsId): self
     {
@@ -67,4 +67,4 @@ class ReportSms extends AbstractReport
     {
         return $this->smsId;
     }
-}
+}

+ 3 - 1
src/Entity/Message/Sms.php

@@ -3,6 +3,7 @@ declare(strict_types=1);
 
 namespace App\Entity\Message;
 
+use ApiPlatform\Metadata\ApiResource;
 use App\Entity\Access\Access;
 use App\Entity\Core\Tagg;
 //use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
@@ -18,6 +19,7 @@ use Ramsey\Uuid\Uuid;
  * Classe ... qui ...
  */
 //#[Auditable]
+#[ApiResource(operations: [])]
 #[ORM\Table(name: 'Message')]
 #[ORM\Entity]
 class Sms extends AbstractMessage
@@ -122,4 +124,4 @@ class Sms extends AbstractMessage
 
         return $this;
     }
-}
+}

+ 0 - 0
src/Service/OnChange/Organization/OnSubdomainChange.php


+ 1 - 0
src/Service/Typo3/SubdomainService.php

@@ -191,6 +191,7 @@ class SubdomainService
     protected function getMailModel(Subdomain $subdomain): SubdomainChangeModel {
         $adminAccess = $this->accessRepository->findAdminAccess($subdomain->getOrganization());
 
+        /** @phpstan-ignore-next-line */
         return (new SubdomainChangeModel())
             ->setOrganizationId($subdomain->getOrganization()->getId())
             ->setSubdomainId($subdomain->getId())

+ 3 - 3
src/State/Provider/Cotisation/CotisationProvider.php

@@ -28,10 +28,10 @@ final class CotisationProvider implements ProviderInterface
      */
     public function provide(Operation $operation, array $uriVariables = [], array $context = []): ?Cotisation
     {
-        if($operation instanceof GetCollection) {
+        if ($operation instanceof GetCollection) {
             throw new RuntimeException('not supported', 500);
         }
 
-        return $this->cotisationCreator->getCotisation($uriVariables['id']);
+        return $this->cotisationCreator->getCotisation($uriVariables['organizationId']);
     }
-}
+}

+ 17 - 17
tests/Service/Typo3/SubdomainServiceTest.php

@@ -64,7 +64,7 @@ class SubdomainServiceTest extends TestCase
         $this->accessRepository = $this->getMockBuilder(AccessRepository::class)->disableOriginalConstructor()->getMock();
     }
 
-    private function makeOnSubdomainChangeMock(string $methodName): MockObject | TestableSubdomainService {
+    private function makeSubdomainServiceMockFor(string $methodName): MockObject | TestableSubdomainService {
         return $this->getMockBuilder(TestableSubdomainService::class)
             ->setConstructorArgs([
                 $this->subdomainRepository,
@@ -83,7 +83,7 @@ class SubdomainServiceTest extends TestCase
      */
     public function testCanRegisterNewSubdomainTrue(): void
     {
-        $subdomainService = $this->makeOnSubdomainChangeMock('canRegisterNewSubdomain');
+        $subdomainService = $this->makeSubdomainServiceMockFor('canRegisterNewSubdomain');
 
         $organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
         $organization->expects(self::once())->method('getSubdomains')->willReturn(new ArrayCollection([1, 2]));
@@ -96,7 +96,7 @@ class SubdomainServiceTest extends TestCase
      */
     public function testCanRegisterNewSubdomainFalse(): void
     {
-        $subdomainService = $this->makeOnSubdomainChangeMock('canRegisterNewSubdomain');
+        $subdomainService = $this->makeSubdomainServiceMockFor('canRegisterNewSubdomain');
 
         $organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
         $organization->expects(self::once())->method('getSubdomains')->willReturn(new ArrayCollection([1, 2, 3]));
@@ -108,7 +108,7 @@ class SubdomainServiceTest extends TestCase
      * @see SubdomainService::isValidSubdomain()
      */
     public function testIsValidSubdomain(): void {
-        $subdomainService = $this->makeOnSubdomainChangeMock('isValidSubdomain');
+        $subdomainService = $this->makeSubdomainServiceMockFor('isValidSubdomain');
 
         $this->assertTrue($subdomainService->isValidSubdomain('abcd'));
         $this->assertTrue($subdomainService->isValidSubdomain('abcdefgh'));
@@ -122,7 +122,7 @@ class SubdomainServiceTest extends TestCase
     }
 
     public function testAddNewSubdomain(): void {
-        $subdomainService = $this->makeOnSubdomainChangeMock('addNewSubdomain');
+        $subdomainService = $this->makeSubdomainServiceMockFor('addNewSubdomain');
 
         $organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
 
@@ -147,7 +147,7 @@ class SubdomainServiceTest extends TestCase
 
     public function testAddNewSubdomainInvalid(): void
     {
-        $subdomainService = $this->makeOnSubdomainChangeMock('addNewSubdomain');
+        $subdomainService = $this->makeSubdomainServiceMockFor('addNewSubdomain');
 
         $organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
 
@@ -168,7 +168,7 @@ class SubdomainServiceTest extends TestCase
 
     public function testAddNewSubdomainMaxReached(): void
     {
-        $subdomainService = $this->makeOnSubdomainChangeMock('addNewSubdomain');
+        $subdomainService = $this->makeSubdomainServiceMockFor('addNewSubdomain');
 
         $organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
 
@@ -189,7 +189,7 @@ class SubdomainServiceTest extends TestCase
 
     public function testAddNewSubdomainExisting(): void
     {
-        $subdomainService = $this->makeOnSubdomainChangeMock('addNewSubdomain');
+        $subdomainService = $this->makeSubdomainServiceMockFor('addNewSubdomain');
 
         $organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
 
@@ -210,7 +210,7 @@ class SubdomainServiceTest extends TestCase
 
     public function testAddNewSubdomainAndActivate(): void
     {
-        $subdomainService = $this->makeOnSubdomainChangeMock('addNewSubdomain');
+        $subdomainService = $this->makeSubdomainServiceMockFor('addNewSubdomain');
 
         $organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
 
@@ -224,7 +224,7 @@ class SubdomainServiceTest extends TestCase
     }
 
     public function testActivateSubdomain(): void {
-        $subdomainService = $this->makeOnSubdomainChangeMock('activateSubdomain');
+        $subdomainService = $this->makeSubdomainServiceMockFor('activateSubdomain');
 
         $organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
 
@@ -265,7 +265,7 @@ class SubdomainServiceTest extends TestCase
 
     public function testActivateSubdomainAlreadyActive(): void
     {
-        $subdomainService = $this->makeOnSubdomainChangeMock('activateSubdomain');
+        $subdomainService = $this->makeSubdomainServiceMockFor('activateSubdomain');
 
         $subdomain = $this->getMockBuilder(Subdomain::class)->getMock();
         $subdomain->method('getId')->willReturn(1);
@@ -285,7 +285,7 @@ class SubdomainServiceTest extends TestCase
 
     public function testActivateSubdomainNotPersisted(): void
     {
-        $subdomainService = $this->makeOnSubdomainChangeMock('activateSubdomain');
+        $subdomainService = $this->makeSubdomainServiceMockFor('activateSubdomain');
 
         $subdomain = $this->getMockBuilder(Subdomain::class)->getMock();
         $subdomain->method('getId')->willReturn(null);
@@ -303,7 +303,7 @@ class SubdomainServiceTest extends TestCase
     }
 
     public function testSetOrganizationActiveSubdomain(): void {
-        $subdomainService = $this->makeOnSubdomainChangeMock('setOrganizationActiveSubdomain');
+        $subdomainService = $this->makeSubdomainServiceMockFor('setOrganizationActiveSubdomain');
 
         $organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
 
@@ -340,7 +340,7 @@ class SubdomainServiceTest extends TestCase
     }
 
     public function testRenameAdminUserToMatchSubdomain(): void {
-        $subdomainService = $this->makeOnSubdomainChangeMock('renameAdminUserToMatchSubdomain');
+        $subdomainService = $this->makeSubdomainServiceMockFor('renameAdminUserToMatchSubdomain');
 
         $organization = $this->getMockBuilder(Organization::class)->getMock();
         $person = $this->getMockBuilder(Person::class)->getMock();
@@ -365,7 +365,7 @@ class SubdomainServiceTest extends TestCase
     }
 
     public function testUpdateTypo3Website(): void {
-        $subdomainService = $this->makeOnSubdomainChangeMock('updateTypo3Website');
+        $subdomainService = $this->makeSubdomainServiceMockFor('updateTypo3Website');
 
         $organization = $this->getMockBuilder(Organization::class)->getMock();
         $organization->method('getId')->willReturn(1);
@@ -380,7 +380,7 @@ class SubdomainServiceTest extends TestCase
     }
 
     public function testGetMailModel(): void {
-        $subdomainService = $this->makeOnSubdomainChangeMock('getMailModel');
+        $subdomainService = $this->makeSubdomainServiceMockFor('getMailModel');
 
         $access = $this->getMockBuilder(Access::class)->getMock();
         $access->method('getId')->willReturn(1);
@@ -413,7 +413,7 @@ class SubdomainServiceTest extends TestCase
     }
 
     public function testSendConfirmationEmail(): void {
-        $subdomainService = $this->makeOnSubdomainChangeMock('sendConfirmationEmail');
+        $subdomainService = $this->makeSubdomainServiceMockFor('sendConfirmationEmail');
 
         $subdomain = $this->getMockBuilder(Subdomain::class)->getMock();
         $subdomainChangeModel = $this->getMockBuilder(SubdomainChangeModel::class)->getMock();