From 0fbe8ccb32f767a8e0babe587a240aef2cebe1af Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Mon, 20 Nov 2023 19:07:36 +0100 Subject: [PATCH] IBX-6338: Fixed typo in sort definition (#34) --- src/bundle/Form/Type/SearchType.php | 2 +- ...nChoiceType.php => SortingDefinitionChoiceType.php} | 2 +- src/bundle/Resources/config/forms.yaml | 4 ++-- src/bundle/Resources/config/sorting_definitions.yaml | 2 +- .../Resources/translations/ibexa_search.en.xliff | 4 ++-- ...face.php => SortingDefinitionProviderInterface.php} | 2 +- .../Provider/DateSortingDefinitionProvider.php | 4 ++-- ...nProvider.php => NameSortingDefinitionProvider.php} | 10 +++++----- .../Provider/RelevanceSortingDefinitionProvider.php | 6 +++--- .../SortingDefinition/SortingDefinitionRegistry.php | 4 ++-- ...rTest.php => NameSortingDefinitionProviderTest.php} | 8 ++++---- .../RelevanceSortingDefinitionProviderTest.php | 4 ++-- .../SortingDefinitionRegistryTest.php | 6 +++--- 13 files changed, 29 insertions(+), 29 deletions(-) rename src/bundle/Form/Type/{SortingDefintionChoiceType.php => SortingDefinitionChoiceType.php} (96%) rename src/contracts/SortingDefinition/{SortingDefintionProviderInterface.php => SortingDefinitionProviderInterface.php} (90%) rename src/lib/SortingDefinition/Provider/{NameSortingDefintionProvider.php => NameSortingDefinitionProvider.php} (87%) rename tests/lib/SortingDefinition/Provider/{NameSortingDefintionProviderTest.php => NameSortingDefinitionProviderTest.php} (92%) diff --git a/src/bundle/Form/Type/SearchType.php b/src/bundle/Form/Type/SearchType.php index 21f4e75..96b974f 100644 --- a/src/bundle/Form/Type/SearchType.php +++ b/src/bundle/Form/Type/SearchType.php @@ -83,7 +83,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder->add( 'sort', - SortingDefintionChoiceType::class, + SortingDefinitionChoiceType::class, [ 'property_path' => 'sortingDefinition', ] diff --git a/src/bundle/Form/Type/SortingDefintionChoiceType.php b/src/bundle/Form/Type/SortingDefinitionChoiceType.php similarity index 96% rename from src/bundle/Form/Type/SortingDefintionChoiceType.php rename to src/bundle/Form/Type/SortingDefinitionChoiceType.php index 3db0c09..9730778 100644 --- a/src/bundle/Form/Type/SortingDefintionChoiceType.php +++ b/src/bundle/Form/Type/SortingDefinitionChoiceType.php @@ -14,7 +14,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\OptionsResolver\OptionsResolver; -final class SortingDefintionChoiceType extends AbstractType +final class SortingDefinitionChoiceType extends AbstractType { private SortingDefinitionRegistryInterface $sortingDefinitionRegistry; diff --git a/src/bundle/Resources/config/forms.yaml b/src/bundle/Resources/config/forms.yaml index 578bf26..5fe5211 100644 --- a/src/bundle/Resources/config/forms.yaml +++ b/src/bundle/Resources/config/forms.yaml @@ -41,11 +41,11 @@ services: tags: - { name: form.type, alias: Ibexa\Bundle\Search\Form\Type\SectionChoiceType } - Ibexa\Bundle\Search\Form\Type\SortingDefintionChoiceType: + Ibexa\Bundle\Search\Form\Type\SortingDefinitionChoiceType: arguments: $sortingDefinitionRegistry: '@Ibexa\Contracts\Search\SortingDefinition\SortingDefinitionRegistryInterface' tags: - - { name: form.type, alias: Ibexa\Bundle\Search\Form\Type\SortingDefintionChoiceType } + - { name: form.type, alias: Ibexa\Bundle\Search\Form\Type\SortingDefinitionChoiceType } Ibexa\Bundle\Search\Form\Type\SearchUsersType: arguments: diff --git a/src/bundle/Resources/config/sorting_definitions.yaml b/src/bundle/Resources/config/sorting_definitions.yaml index fa15759..23f6bb3 100644 --- a/src/bundle/Resources/config/sorting_definitions.yaml +++ b/src/bundle/Resources/config/sorting_definitions.yaml @@ -4,7 +4,7 @@ services: autowire: true public: false - Ibexa\Search\SortingDefinition\Provider\NameSortingDefintionProvider: + Ibexa\Search\SortingDefinition\Provider\NameSortingDefinitionProvider: tags: - name: ibexa.search.sorting_definition.provider diff --git a/src/bundle/Resources/translations/ibexa_search.en.xliff b/src/bundle/Resources/translations/ibexa_search.en.xliff index 6c18ede..a9fae90 100644 --- a/src/bundle/Resources/translations/ibexa_search.en.xliff +++ b/src/bundle/Resources/translations/ibexa_search.en.xliff @@ -136,10 +136,10 @@ Sort by name Z-A key: sort_definition.name_desc.label - + Sort by relevance Sort by relevance - key: sort_defintion.relevance.label + key: sort_definition.relevance.label diff --git a/src/contracts/SortingDefinition/SortingDefintionProviderInterface.php b/src/contracts/SortingDefinition/SortingDefinitionProviderInterface.php similarity index 90% rename from src/contracts/SortingDefinition/SortingDefintionProviderInterface.php rename to src/contracts/SortingDefinition/SortingDefinitionProviderInterface.php index f95d2c3..5ebb170 100644 --- a/src/contracts/SortingDefinition/SortingDefintionProviderInterface.php +++ b/src/contracts/SortingDefinition/SortingDefinitionProviderInterface.php @@ -8,7 +8,7 @@ namespace Ibexa\Contracts\Search\SortingDefinition; -interface SortingDefintionProviderInterface +interface SortingDefinitionProviderInterface { /** * @return \Ibexa\Contracts\Search\SortingDefinition\SortingDefinitionInterface[] diff --git a/src/lib/SortingDefinition/Provider/DateSortingDefinitionProvider.php b/src/lib/SortingDefinition/Provider/DateSortingDefinitionProvider.php index dcb8ca7..fc7f414 100644 --- a/src/lib/SortingDefinition/Provider/DateSortingDefinitionProvider.php +++ b/src/lib/SortingDefinition/Provider/DateSortingDefinitionProvider.php @@ -12,12 +12,12 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\DateModified; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\DatePublished; use Ibexa\Contracts\Search\SortingDefinition\SortingDefinition; -use Ibexa\Contracts\Search\SortingDefinition\SortingDefintionProviderInterface; +use Ibexa\Contracts\Search\SortingDefinition\SortingDefinitionProviderInterface; use JMS\TranslationBundle\Model\Message; use JMS\TranslationBundle\Translation\TranslationContainerInterface; use Symfony\Contracts\Translation\TranslatorInterface; -final class DateSortingDefinitionProvider implements SortingDefintionProviderInterface, TranslationContainerInterface +final class DateSortingDefinitionProvider implements SortingDefinitionProviderInterface, TranslationContainerInterface { private TranslatorInterface $translator; diff --git a/src/lib/SortingDefinition/Provider/NameSortingDefintionProvider.php b/src/lib/SortingDefinition/Provider/NameSortingDefinitionProvider.php similarity index 87% rename from src/lib/SortingDefinition/Provider/NameSortingDefintionProvider.php rename to src/lib/SortingDefinition/Provider/NameSortingDefinitionProvider.php index e8342e4..87f7a36 100644 --- a/src/lib/SortingDefinition/Provider/NameSortingDefintionProvider.php +++ b/src/lib/SortingDefinition/Provider/NameSortingDefinitionProvider.php @@ -14,12 +14,12 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\ContentTranslatedName; use Ibexa\Contracts\Search\SortingDefinition\SortingDefinition; use Ibexa\Contracts\Search\SortingDefinition\SortingDefinitionInterface; -use Ibexa\Contracts\Search\SortingDefinition\SortingDefintionProviderInterface; +use Ibexa\Contracts\Search\SortingDefinition\SortingDefinitionProviderInterface; use JMS\TranslationBundle\Model\Message; use JMS\TranslationBundle\Translation\TranslationContainerInterface; use Symfony\Contracts\Translation\TranslatorInterface; -final class NameSortingDefintionProvider implements SortingDefintionProviderInterface, TranslationContainerInterface +final class NameSortingDefinitionProvider implements SortingDefinitionProviderInterface, TranslationContainerInterface { private RepositoryConfigurationProvider $configurationProvider; @@ -34,12 +34,12 @@ public function __construct(RepositoryConfigurationProvider $configurationProvid public function getSortingDefinitions(): array { return [ - $this->createSortingDefintion(200, false), - $this->createSortingDefintion(300, true), + $this->createSortingDefinition(200, false), + $this->createSortingDefinition(300, true), ]; } - private function createSortingDefintion(int $priority, bool $reverse): SortingDefinitionInterface + private function createSortingDefinition(int $priority, bool $reverse): SortingDefinitionInterface { $identifier = $this->getIdentifier($reverse); diff --git a/src/lib/SortingDefinition/Provider/RelevanceSortingDefinitionProvider.php b/src/lib/SortingDefinition/Provider/RelevanceSortingDefinitionProvider.php index 5606496..4603d6f 100644 --- a/src/lib/SortingDefinition/Provider/RelevanceSortingDefinitionProvider.php +++ b/src/lib/SortingDefinition/Provider/RelevanceSortingDefinitionProvider.php @@ -13,10 +13,10 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\DateModified; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\Score; use Ibexa\Contracts\Search\SortingDefinition\SortingDefinition; -use Ibexa\Contracts\Search\SortingDefinition\SortingDefintionProviderInterface; +use Ibexa\Contracts\Search\SortingDefinition\SortingDefinitionProviderInterface; use Symfony\Contracts\Translation\TranslatorInterface; -final class RelevanceSortingDefinitionProvider implements SortingDefintionProviderInterface +final class RelevanceSortingDefinitionProvider implements SortingDefinitionProviderInterface { private SearchService $searchService; @@ -44,7 +44,7 @@ private function getLabel(): string { return $this->translator->trans( /** @Desc("Sort by relevance") */ - 'sort_defintion.relevance.label', + 'sort_definition.relevance.label', [], 'ibexa_search' ); diff --git a/src/lib/SortingDefinition/SortingDefinitionRegistry.php b/src/lib/SortingDefinition/SortingDefinitionRegistry.php index b498949..638bbe0 100644 --- a/src/lib/SortingDefinition/SortingDefinitionRegistry.php +++ b/src/lib/SortingDefinition/SortingDefinitionRegistry.php @@ -13,14 +13,14 @@ final class SortingDefinitionRegistry implements SortingDefinitionRegistryInterface { - /** @var iterable<\Ibexa\Contracts\Search\SortingDefinition\SortingDefintionProviderInterface> */ + /** @var iterable<\Ibexa\Contracts\Search\SortingDefinition\SortingDefinitionProviderInterface> */ private iterable $providers; /** @var \Ibexa\Contracts\Search\SortingDefinition\SortingDefinitionInterface[] */ private ?array $definitions = null; /** - * @param iterable<\Ibexa\Contracts\Search\SortingDefinition\SortingDefintionProviderInterface> $providers + * @param iterable<\Ibexa\Contracts\Search\SortingDefinition\SortingDefinitionProviderInterface> $providers */ public function __construct(iterable $providers) { diff --git a/tests/lib/SortingDefinition/Provider/NameSortingDefintionProviderTest.php b/tests/lib/SortingDefinition/Provider/NameSortingDefinitionProviderTest.php similarity index 92% rename from tests/lib/SortingDefinition/Provider/NameSortingDefintionProviderTest.php rename to tests/lib/SortingDefinition/Provider/NameSortingDefinitionProviderTest.php index 94c43f9..a78c1e5 100644 --- a/tests/lib/SortingDefinition/Provider/NameSortingDefintionProviderTest.php +++ b/tests/lib/SortingDefinition/Provider/NameSortingDefinitionProviderTest.php @@ -13,11 +13,11 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\ContentName; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\ContentTranslatedName; use Ibexa\Contracts\Search\SortingDefinition\SortingDefinition; -use Ibexa\Search\SortingDefinition\Provider\NameSortingDefintionProvider; +use Ibexa\Search\SortingDefinition\Provider\NameSortingDefinitionProvider; use PHPUnit\Framework\TestCase; use Symfony\Contracts\Translation\TranslatorInterface; -final class NameSortingDefintionProviderTest extends TestCase +final class NameSortingDefinitionProviderTest extends TestCase { /** @var \Symfony\Contracts\Translation\TranslatorInterface&\PHPUnit\Framework\MockObject\MockObject */ private TranslatorInterface $translator; @@ -25,7 +25,7 @@ final class NameSortingDefintionProviderTest extends TestCase /** @var \Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider&\PHPUnit\Framework\MockObject\MockObject */ private RepositoryConfigurationProvider $configurationProvider; - private NameSortingDefintionProvider $provider; + private NameSortingDefinitionProvider $provider; protected function setUp(): void { @@ -34,7 +34,7 @@ protected function setUp(): void $this->configurationProvider = $this->createMock(RepositoryConfigurationProvider::class); - $this->provider = new NameSortingDefintionProvider( + $this->provider = new NameSortingDefinitionProvider( $this->configurationProvider, $this->translator ); diff --git a/tests/lib/SortingDefinition/Provider/RelevanceSortingDefinitionProviderTest.php b/tests/lib/SortingDefinition/Provider/RelevanceSortingDefinitionProviderTest.php index 58700d2..b8fe4e4 100644 --- a/tests/lib/SortingDefinition/Provider/RelevanceSortingDefinitionProviderTest.php +++ b/tests/lib/SortingDefinition/Provider/RelevanceSortingDefinitionProviderTest.php @@ -51,7 +51,7 @@ public function testGetSortingDefinitionsWithScoringCapability(): void [ new SortingDefinition( 'relevance', - 'sort_defintion.relevance.label', + 'sort_definition.relevance.label', [ new Score(Query::SORT_DESC), ], @@ -73,7 +73,7 @@ public function testGetSortingDefinitionsWithoutScoringCapability(): void [ new SortingDefinition( 'relevance', - 'sort_defintion.relevance.label', + 'sort_definition.relevance.label', [ new DateModified(Query::SORT_DESC), ], diff --git a/tests/lib/SortingDefinition/SortingDefinitionRegistryTest.php b/tests/lib/SortingDefinition/SortingDefinitionRegistryTest.php index bfaa731..004f433 100644 --- a/tests/lib/SortingDefinition/SortingDefinitionRegistryTest.php +++ b/tests/lib/SortingDefinition/SortingDefinitionRegistryTest.php @@ -9,7 +9,7 @@ namespace Ibexa\Tests\Search\SortingDefinition; use Ibexa\Contracts\Search\SortingDefinition\SortingDefinitionInterface; -use Ibexa\Contracts\Search\SortingDefinition\SortingDefintionProviderInterface; +use Ibexa\Contracts\Search\SortingDefinition\SortingDefinitionProviderInterface; use Ibexa\Search\SortingDefinition\SortingDefinitionRegistry; use PHPUnit\Framework\TestCase; @@ -55,9 +55,9 @@ public function testGetSortingDefinitions(): void /** * @param \Ibexa\Contracts\Search\SortingDefinition\SortingDefinitionInterface[] $definitions */ - private function createProvider(array $definitions): SortingDefintionProviderInterface + private function createProvider(array $definitions): SortingDefinitionProviderInterface { - $provider = $this->createMock(SortingDefintionProviderInterface::class); + $provider = $this->createMock(SortingDefinitionProviderInterface::class); $provider->method('getSortingDefinitions')->willReturn($definitions); return $provider;