Browse Source

correction retours

Vincent 3 months ago
parent
commit
a4911b8ef3

+ 1 - 0
config/opentalent/enum.yaml

@@ -55,6 +55,7 @@ parameters:
           organization_legal: 'App\Enum\Organization\LegalEnum'
           organization_opca: 'App\Enum\Organization\OpcaEnum'
           organization_principal_type: 'App\Enum\Organization\PrincipalTypeEnum'
+          organization_principal_type_short_list: 'App\Enum\Organization\PrincipalTypeShortListEnum'
           organization_school_cat: 'App\Enum\Organization\SchoolCategoryEnum'
           organization_type_establishment_detail: 'App\Enum\Organization\TypeEstablishmentDetailEnum'
           organization_type_establishment: 'App\Enum\Organization\TypeEstablishmentEnum'

+ 5 - 2
config/opentalent/products.yaml

@@ -4,8 +4,6 @@ parameters:
         resources:
           - AccessProfile
           - Tips
-          - Notification
-          - NotificationUser
           - File
           - Image
           - City
@@ -23,8 +21,12 @@ parameters:
           - AccessProfile
           - EventCategory
           - PlaceSearchItem
+          - EventGender
+          - TypeOfPractice
       Common:
         resources:
+          - Notification
+          - NotificationUser
           - Preferences
           - ContactPoint
           - PersonalizedList
@@ -293,6 +295,7 @@ parameters:
           - Reward
 
       Basicompta:
+        resources: ~
         roles:
           - ROLE_BASICOMPTA
 

+ 3 - 0
src/ApiResources/Freemium/FreemiumEvent.php

@@ -17,6 +17,7 @@ use ApiPlatform\Metadata\Post;
 use App\ApiResources\ApiResourcesInterface;
 use App\Attribute\OrganizationDefaultValue;
 use App\Entity\Booking\Event;
+use App\Entity\Booking\EventGender;
 use App\Entity\Core\Categories;
 use App\Entity\Core\Country;
 use App\Entity\Core\File;
@@ -123,6 +124,8 @@ class FreemiumEvent implements ApiResourcesInterface
 
     public ?PricingEventEnum $pricing = null;
 
+    public ?EventGender $gender;
+
     #[Assert\Positive()]
     public ?float $priceMini = null;
     #[Assert\Positive()]

+ 37 - 1
src/ApiResources/Freemium/FreemiumOrganization.php

@@ -12,8 +12,12 @@ use App\ApiResources\ApiResourcesInterface;
 use App\Entity\Core\Country;
 use App\Entity\Core\File;
 use App\Entity\Organization\Organization;
+use App\Entity\Organization\TypeOfPractice;
+use App\Enum\Organization\LegalEnum;
+use App\Enum\Organization\PrincipalTypeEnum;
 use App\State\Processor\Freemium\FreemiumOrganizationProcessor;
 use App\State\Provider\Freemium\FreemiumOrganizationProvider;
+use Doctrine\Common\Collections\ArrayCollection;
 use libphonenumber\PhoneNumber;
 use Symfony\Component\ObjectMapper\Attribute\Map;
 use Symfony\Component\Validator\Constraints as Assert;
@@ -42,10 +46,17 @@ class FreemiumOrganization implements ApiResourcesInterface
     public ?int $id = null;
 
     #[Assert\Length(max: 128)]
-    public ?string $name = null;
+    public string $name;
 
     public ?string $description = null;
 
+    public ?LegalEnum $legalStatus = null;
+
+    public ?PrincipalTypeEnum $principalType = null;
+
+    #[Map(if: false)]
+    public ArrayCollection $typeOfPractices;
+
     #[Map(source: 'principalContactPoint?.email')]
     #[Assert\Email(message: 'invalid-email-format', mode: 'strict')]
     #[Assert\Length(max: 255)]
@@ -97,4 +108,29 @@ class FreemiumOrganization implements ApiResourcesInterface
     public bool $portailVisibility = true;
 
     public ?File $logo = null;
+
+    /**
+     * @return array<TypeOfPractice>
+     */
+    public function getTypeOfPractices(): array
+    {
+        // retourne un tableau proprement indexé
+        return array_values($this->typeOfPractices->toArray());
+    }
+
+    public function addTypeOfPractice(TypeOfPractice $typeOfPractices): self
+    {
+        if (!$this->typeOfPractices->contains($typeOfPractices)) {
+            $this->typeOfPractices[] = $typeOfPractices;
+        }
+
+        return $this;
+    }
+
+    public function removeTypeOfPractice(TypeOfPractice $typeOfPractices): self
+    {
+        $this->typeOfPractices->removeElement($typeOfPractices);
+
+        return $this;
+    }
 }

+ 16 - 0
src/Entity/Booking/Event.php

@@ -13,6 +13,7 @@ use App\Entity\Place\PlaceSystem;
 use App\Entity\Place\Room;
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
 use App\Enum\Booking\PricingEventEnum;
+use App\Enum\Booking\VisibilityEnum;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
@@ -117,6 +118,9 @@ class Event extends AbstractBooking
     #[Assert\Positive]
     protected ?float $priceMaxi = null;
 
+    #[ORM\Column(length: 255, nullable: false, enumType: VisibilityEnum::class)]
+    protected VisibilityEnum $visibility;
+
     public function __construct()
     {
         $this->eventRecur = new ArrayCollection();
@@ -492,4 +496,16 @@ class Event extends AbstractBooking
 
         return $this;
     }
+
+    public function getVisibility(): ?VisibilityEnum
+    {
+        return $this->visibility;
+    }
+
+    public function setVisibility(?VisibilityEnum $visibility): self
+    {
+        $this->visibility = $visibility;
+
+        return $this;
+    }
 }

+ 31 - 1
src/Entity/Booking/EventGender.php

@@ -5,14 +5,28 @@ declare(strict_types=1);
 namespace App\Entity\Booking;
 
 // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
+use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
+use ApiPlatform\Metadata\ApiFilter;
 use ApiPlatform\Metadata\ApiResource;
+use ApiPlatform\Metadata\Get;
+use ApiPlatform\Metadata\GetCollection;
+use App\Enum\Booking\EventGenderTypeEnum;
 use Doctrine\ORM\Mapping as ORM;
 
 /**
  * Enum des genres d'évènements.
  */
 // #[Auditable]
-#[ApiResource(operations: [])]
+#[ApiResource(
+    operations: [
+        new Get(security: 'is_granted(\'ROLE_EVENTS\') or is_granted(\'ROLE_USER_FREEMIUM\')'),
+        new GetCollection(
+            paginationEnabled: false,
+            security: 'is_granted(\'ROLE_EVENTS\') or is_granted(\'ROLE_USER_FREEMIUM\')'
+        ),
+    ]
+)]
+#[ApiFilter(filterClass: SearchFilter::class, properties: ['type' => 'exact'])]
 #[ORM\Entity]
 class EventGender
 {
@@ -21,8 +35,24 @@ class EventGender
     #[ORM\GeneratedValue]
     private ?int $id = null;
 
+    #[ORM\Column]
+    protected string $name;
+
+    #[ORM\Column(length: 255, nullable: false, enumType: EventGenderTypeEnum::class)]
+    protected EventGenderTypeEnum $type;
+
     public function getId(): ?int
     {
         return $this->id;
     }
+
+    public function getName(): string
+    {
+        return $this->name;
+    }
+
+    public function getType(): EventGenderTypeEnum
+    {
+        return $this->type;
+    }
 }

+ 13 - 8
src/Entity/Organization/TypeOfPractice.php

@@ -5,6 +5,8 @@ declare(strict_types=1);
 namespace App\Entity\Organization;
 
 use ApiPlatform\Metadata\ApiResource;
+use ApiPlatform\Metadata\Get;
+use ApiPlatform\Metadata\GetCollection;
 use App\Enum\Cotisation\CategoryTypeOfPracticeEnum;
 use App\Enum\Cotisation\TypeOfPracticeEnum;
 use App\Repository\Organization\TypeOfPracticeRepository;
@@ -13,12 +15,20 @@ use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 use JetBrains\PhpStorm\Pure;
-use Symfony\Component\Serializer\Annotation\Groups;
 
 /**
  * Type des pratique d'une organisation.
  */
-#[ApiResource(operations: [])]
+#[ApiResource(
+    operations: [
+        new Get(
+            security: 'is_granted(\'ROLE_GENERAL_CONFIG\') or is_granted(\'ROLE_USER_FREEMIUM\')'),
+        new GetCollection(
+            paginationEnabled: false,
+            security: 'is_granted(\'ROLE_GENERAL_CONFIG\') or is_granted(\'ROLE_USER_FREEMIUM\')'
+        ),
+    ]
+)]
 // #[Auditable]
 #[ORM\Entity(repositoryClass: TypeOfPracticeRepository::class)]
 class TypeOfPractice
@@ -26,22 +36,17 @@ class TypeOfPractice
     #[ORM\Id]
     #[ORM\Column]
     #[ORM\GeneratedValue]
-    #[Groups(['read'])]
     private ?int $id = null;
 
     #[ORM\Column(length: 50, nullable: true, enumType: TypeOfPracticeEnum::class)]
-    #[Groups(['read'])]
     private ?TypeOfPracticeEnum $name = null;
 
     #[ORM\Column(length: 50, nullable: true, enumType: CategoryTypeOfPracticeEnum::class)]
-    #[Groups(['read'])]
     private ?CategoryTypeOfPracticeEnum $category = null;
 
     /** @var Collection<int, Organization> */
-    #[ORM\ManyToMany(targetEntity: Organization::class, inversedBy: 'typeOfPractices')]
+    #[ORM\ManyToMany(targetEntity: Organization::class, inversedBy: 'typeOfPractices', fetch: 'EXTRA_LAZY')]
     #[ORM\JoinTable(name: 'organization_type_of_practices')]
-    #[ORM\JoinColumn(name: 'typeofpractice_id', referencedColumnName: 'id')]
-    #[ORM\InverseJoinColumn(name: 'organization_id', referencedColumnName: 'id')]
     private Collection $organizations;
 
     #[Pure]

+ 19 - 0
src/Enum/Booking/EventGenderTypeEnum.php

@@ -0,0 +1,19 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Enum\Booking;
+
+use App\Enum\EnumMethodsTrait;
+
+/**
+ * Groupe des genre des événements.
+ */
+enum EventGenderTypeEnum: string
+{
+    use EnumMethodsTrait;
+
+    case PEDAGOGIC_EVENT = 'PEDAGOGIC_EVENT';
+    case CULTURAL_EVENT = 'CULTURAL_EVENT';
+    case INTERNAL_EVENT = 'INTERNAL_EVENT';
+}

+ 2 - 0
src/Enum/Cotisation/CategoryTypeOfPracticeEnum.php

@@ -18,4 +18,6 @@ enum CategoryTypeOfPracticeEnum: string
     case CATEGORY_CHORUS = 'CATEGORY_CHORUS';
     case CATEGORY_BAND = 'CATEGORY_BAND';
     case CATEGORY_OTHER = 'CATEGORY_OTHER';
+    case CATEGORY_DANCES = 'CATEGORY_DANCES';
+    case CATEGORY_TEACHING = 'CATEGORY_TEACHING';
 }

+ 19 - 0
src/Enum/Organization/PrincipalTypeShortListEnum.php

@@ -0,0 +1,19 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Enum\Organization;
+
+use App\Enum\EnumMethodsTrait;
+
+/**
+ * Types principaux raccourci d'une organisation.
+ */
+enum PrincipalTypeShortListEnum: string
+{
+    use EnumMethodsTrait;
+
+    case ARTISTIC_EDUCATION_ONLY = 'ARTISTIC_EDUCATION_ONLY';
+    case ARTISTIC_PRACTICE_ONLY = 'ARTISTIC_PRACTICE_ONLY';
+    case ARTISTIC_PRACTICE_EDUCATION = 'ARTISTIC_PRACTICE_EDUCATION';
+}

+ 9 - 7
src/Security/Voter/ModuleVoter.php

@@ -43,10 +43,10 @@ class ModuleVoter extends Voter
         }
 
         $resourceMetadata = $this->resourceMetadataFactory->create($subject->attributes->get('_api_resource_class'));
-        $module = $this->module->getModuleByResourceName($resourceMetadata->getOperation()->getShortName());
+        $modules = $this->module->getModulesByResourceName($resourceMetadata->getOperation()->getShortName());
 
         // Check if there is a module for this entity : eq configuration problem
-        if ($module === null) {
+        if (empty($modules)) {
             throw new AccessDeniedHttpException(sprintf('There are no module for the entity (%s) !', $resourceMetadata->getOperation()->getShortName()));
         }
 
@@ -55,8 +55,8 @@ class ModuleVoter extends Voter
         /** @var Organization $organization */
         $organization = $currentAccess->getOrganization();
 
-        if (!$this->isOrganizationHaveThisModule($organization, $module)) {
-            throw new AccessDeniedHttpException(sprintf("The organization doesn't have the module '%s'", $module));
+        if (!$this->isOrganizationHaveThisModule($organization, $modules)) {
+            throw new AccessDeniedHttpException(sprintf("The organization doesn't have one of the module"));
         }
 
         return true;
@@ -64,12 +64,14 @@ class ModuleVoter extends Voter
 
     /**
      * Test si l'organisation possède le module parmis les modules possédés via le produit souscrit, les options souscrites
-     * ou les modules possédées via des conditions particulières (isCmf par exemple).
+     *  ou les modules possédées via des conditions particulières (isCmf par exemple).
+     *
+     * @param array<string> $modules
      */
-    private function isOrganizationHaveThisModule(Organization $organization, string $module): bool
+    private function isOrganizationHaveThisModule(Organization $organization, array $modules): bool
     {
         $organizationModules = $this->module->getOrganizationModules($organization);
 
-        return in_array($module, $organizationModules);
+        return !empty(array_intersect($organizationModules, $modules));
     }
 }

+ 5 - 0
src/Service/ApiResourceBuilder/Freemium/EventMappingBuilder.php

@@ -8,7 +8,9 @@ use App\ApiResources\Freemium\FreemiumEvent;
 use App\Entity\Booking\Event;
 use App\Entity\Core\AddressPostal;
 use App\Entity\Place\Place;
+use App\Enum\Booking\VisibilityEnum;
 use Doctrine\ORM\EntityManagerInterface;
+use Ramsey\Uuid\Uuid;
 
 /**
  * Mapping des informations d'un Event avec comme source un FreemiumEvent.
@@ -52,6 +54,9 @@ class EventMappingBuilder
         $event->setPricing($freemiumEvent->pricing);
         $event->setPriceMini($freemiumEvent->priceMini);
         $event->setPriceMaxi($freemiumEvent->priceMaxi);
+        $event->setGender($freemiumEvent->gender);
+        $event->setVisibility(VisibilityEnum::PUBLIC_VISIBILITY);
+        $event->setUuid(Uuid::uuid4()->toString());
 
         // Catégories
         $event->removeAllCategories();

+ 53 - 1
src/Service/ApiResourceBuilder/Freemium/OrganizationMappingBuilder.php

@@ -9,11 +9,14 @@ use App\Entity\Core\AddressPostal;
 use App\Entity\Core\ContactPoint;
 use App\Entity\Organization\Organization;
 use App\Entity\Organization\OrganizationAddressPostal;
+use App\Entity\Organization\TypeOfPractice;
 use App\Enum\Core\ContactPointTypeEnum;
 use App\Enum\Organization\AddressPostalOrganizationTypeEnum;
 
 /**
- * Mapping des informations d'une Organization avec comme source un FreemiumOrganization.
+ * Class OrganizationMappingBuilder.
+ *
+ * Mapping class that maps information from a FreemiumOrganization to an Organization entity.
  */
 class OrganizationMappingBuilder
 {
@@ -28,6 +31,9 @@ class OrganizationMappingBuilder
         // Mapping des infos principales
         $this->mapOrganizationInformations($organization, $freemiumOrganization);
 
+        // Mapping des type de pratiques
+        $this->updateOrganizationTypeOfPractices($organization, $freemiumOrganization);
+
         // Mapping des infos du point de contact principal
         $this->mapContactPointInformations($this->getPrincipalContactPointOrCreateNewOne($organization), $freemiumOrganization);
 
@@ -44,6 +50,8 @@ class OrganizationMappingBuilder
     protected function mapOrganizationInformations(Organization $organization, FreemiumOrganization $freemiumOrganization): void
     {
         $organization->setName($freemiumOrganization->name);
+        $organization->setPrincipalType($freemiumOrganization->principalType);
+        $organization->setLegalStatus($freemiumOrganization->legalStatus);
         $organization->setDescription($freemiumOrganization->description);
         $organization->setFacebook($freemiumOrganization->facebook);
         $organization->setYoutube($freemiumOrganization->youtube);
@@ -53,6 +61,50 @@ class OrganizationMappingBuilder
         $organization->setLogo($freemiumOrganization->logo);
     }
 
+    /**
+     * Update the organization's type of practices based on the Freemium organization's type of practices.
+     *
+     * @param Organization         $organization         the organization to update the type of practices for
+     * @param FreemiumOrganization $freemiumOrganization the Freemium organization containing the desired type of practices
+     */
+    protected function updateOrganizationTypeOfPractices(Organization $organization, FreemiumOrganization $freemiumOrganization): void
+    {
+        foreach ($organization->getTypeOfPractices() as $organizationPractice) {
+            $this->removePracticeIfNotInFreemium($organization, $freemiumOrganization, $organizationPractice);
+        }
+
+        foreach ($freemiumOrganization->typeOfPractices as $typeOfPractice) {
+            $this->addPracticeIfNotInOrganization($organization, $typeOfPractice);
+        }
+    }
+
+    /**
+     * Removes a practice from the organization if it is not in the freemium organization.
+     *
+     * @param Organization         $organization         the organization from which to remove the practice
+     * @param FreemiumOrganization $freemiumOrganization the freemium organization used for comparison
+     * @param TypeOfPractice       $organizationPractice the practice to be removed if not in freemium organization
+     */
+    private function removePracticeIfNotInFreemium(Organization $organization, FreemiumOrganization $freemiumOrganization, TypeOfPractice $organizationPractice): void
+    {
+        if (!$freemiumOrganization->typeOfPractices->contains($organizationPractice)) {
+            $organization->removeTypeOfPractice($organizationPractice);
+        }
+    }
+
+    /**
+     * Adds the given TypeOfPractice to the Organization if it is not already associated with it.
+     *
+     * @param Organization   $organization   The organization to add the TypeOfPractice to
+     * @param TypeOfPractice $typeOfPractice The TypeOfPractice to add to the organization
+     */
+    private function addPracticeIfNotInOrganization(Organization $organization, TypeOfPractice $typeOfPractice): void
+    {
+        if (!$organization->getTypeOfPractices()->contains($typeOfPractice)) {
+            $organization->addTypeOfPractice($typeOfPractice);
+        }
+    }
+
     /**
      * Mapping des informations de ContactPoint depuis FreemiumOrganization.
      *

+ 7 - 4
src/Service/Security/Module.php

@@ -149,16 +149,19 @@ class Module
 
     /**
      * Retourne le module possédant la resource passée en paramètre.
+     *
+     * @return array<string>
      */
-    public function getModuleByResourceName(string $resource): int|string|null
+    public function getModulesByResourceName(string $resource): array
     {
+        $resourceModules = [];
         $modules = $this->parameterBag->get('opentalent.modules');
         foreach ($modules as $module => $data) {
-            if ($data['resources'] && in_array($resource, $data['resources'], true)) {
-                return $module;
+            if (array_key_exists('resources', $data) && $data['resources'] && in_array($resource, $data['resources'], true)) {
+                $resourceModules[] = $module;
             }
         }
 
-        return null;
+        return $resourceModules;
     }
 }

+ 11 - 1
src/State/Provider/Freemium/FreemiumOrganizationProvider.php

@@ -10,6 +10,7 @@ use ApiPlatform\State\ProviderInterface;
 use App\ApiResources\Freemium\FreemiumOrganization;
 use App\Entity\Access\Access;
 use App\Entity\Organization\Organization;
+use Doctrine\Common\Collections\ArrayCollection;
 use Symfony\Bundle\SecurityBundle\Security;
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\ObjectMapper\ObjectMapperInterface;
@@ -39,6 +40,15 @@ final class FreemiumOrganizationProvider implements ProviderInterface
         /** @var Organization $organization */
         $organization = $access->getOrganization();
 
-        return $this->objectMapper->map($organization, FreemiumOrganization::class);
+        $freemiumOrganization = $this->objectMapper->map($organization, FreemiumOrganization::class);
+
+        // Afin de s'assurer que les catégories ne sont plus directement liées à l'Event source.
+        $typeOfPractices = new ArrayCollection();
+        foreach ($organization->getTypeOfPractices() as $typeOfPractice) {
+            $typeOfPractices->add($typeOfPractice);
+        }
+        $freemiumOrganization->typeOfPractices = $typeOfPractices;
+
+        return $freemiumOrganization;
     }
 }

+ 3 - 0
tests/Unit/Service/ApiResourceBuilder/Freemium/EventMappingBuilderTest.php

@@ -6,6 +6,7 @@ namespace App\Tests\Unit\Service\ApiResourceBuilder\Freemium;
 
 use App\ApiResources\Freemium\FreemiumEvent;
 use App\Entity\Booking\Event;
+use App\Entity\Booking\EventGender;
 use App\Entity\Core\AddressPostal;
 use App\Entity\Core\Categories;
 use App\Entity\Core\Country;
@@ -92,6 +93,7 @@ class EventMappingBuilderTest extends TestCase
         $image = $this->createMock(File::class);
         $category1 = $this->createMock(Categories::class);
         $category2 = $this->createMock(Categories::class);
+        $eventGender = $this->createMock(EventGender::class);
 
         $freemiumEvent = new FreemiumEvent();
         $freemiumEvent->name = 'Test Event';
@@ -105,6 +107,7 @@ class EventMappingBuilderTest extends TestCase
         $freemiumEvent->pricing = null;
         $freemiumEvent->priceMini = 0.0;
         $freemiumEvent->priceMaxi = 50.0;
+        $freemiumEvent->gender = $eventGender;
         $freemiumEvent->addCategory($category1);
         $freemiumEvent->addCategory($category2);
 

+ 10 - 0
tests/Unit/Service/ApiResourceBuilder/Freemium/OrganizationMappingBuilderTest.php

@@ -24,6 +24,11 @@ class TestableOrganizationMappingBuilder extends OrganizationMappingBuilder
         parent::mapOrganizationInformations($organization, $freemiumOrganization);
     }
 
+    public function updateOrganizationTypeOfPractices(Organization $organization, FreemiumOrganization $freemiumOrganization): void
+    {
+        parent::updateOrganizationTypeOfPractices($organization, $freemiumOrganization);
+    }
+
     public function mapContactPointInformations(ContactPoint $contactPoint, FreemiumOrganization $freemiumOrganization): void
     {
         parent::mapContactPointInformations($contactPoint, $freemiumOrganization);
@@ -73,6 +78,11 @@ class OrganizationMappingBuilderTest extends TestCase
             ->method('mapOrganizationInformations')
             ->with($organization, $freemiumOrganization);
 
+        $organizationMappingBuilder
+            ->expects($this->once())
+            ->method('updateOrganizationTypeOfPractices')
+            ->with($organization, $freemiumOrganization);
+
         $organizationMappingBuilder
             ->expects($this->once())
             ->method('getPrincipalContactPointOrCreateNewOne')

+ 7 - 7
tests/Unit/Service/Security/ModuleTest.php

@@ -200,30 +200,30 @@ class ModuleTest extends TestCase
     }
 
     /**
-     * @see Module::getModuleByResourceName()
+     * @see Module::getModulesByResourceName()
      */
     public function testGetModuleByResourceName(): void
     {
-        $module = $this->getMockForMethod('getModuleByResourceName');
+        $module = $this->getMockForMethod('getModulesByResourceName');
 
         $this->parameterBag->method('get')->with('opentalent.modules')->willReturn(
             ['Core' => ['resources' => ['foo', 'bar']]]
         );
 
-        $this->assertEquals('Core', $module->getModuleByResourceName('foo'));
+        $this->assertEquals(['Core'], $module->getModulesByResourceName('foo'));
     }
 
     /**
-     * @see Module::getModuleByResourceName()
+     * @see Module::getModulesByResourceName()
      */
-    public function testGetModuleByResourceNameNotFound(): void
+    public function testGetModulesByResourceNameNotFound(): void
     {
-        $module = $this->getMockForMethod('getModuleByResourceName');
+        $module = $this->getMockForMethod('getModulesByResourceName');
 
         $this->parameterBag->method('get')->with('opentalent.modules')->willReturn(
             ['Core' => ['resources' => ['bar']]]
         );
 
-        $this->assertNull($module->getModuleByResourceName('foo'));
+        $this->assertEmpty($module->getModulesByResourceName('foo'));
     }
 }