Skip to content

Commit

Permalink
IBX-6338: Fixed typo in sort definition (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
adriendupuis authored Nov 20, 2023
1 parent 32becdd commit 0fbe8cc
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/bundle/Form/Type/SearchType.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)

$builder->add(
'sort',
SortingDefintionChoiceType::class,
SortingDefinitionChoiceType::class,
[
'property_path' => 'sortingDefinition',
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/bundle/Resources/config/forms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Resources/config/sorting_definitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/bundle/Resources/translations/ibexa_search.en.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@
<target state="new">Sort by name Z-A</target>
<note>key: sort_definition.name_desc.label</note>
</trans-unit>
<trans-unit id="48c4f8e4803da42f9c8cd166032d872a88f344c1" resname="sort_defintion.relevance.label">
<trans-unit id="48c4f8e4803da42f9c8cd166032d872a88f344c1" resname="sort_definition.relevance.label">
<source>Sort by relevance</source>
<target state="new">Sort by relevance</target>
<note>key: sort_defintion.relevance.label</note>
<note>key: sort_definition.relevance.label</note>
</trans-unit>
</body>
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Ibexa\Contracts\Search\SortingDefinition;

interface SortingDefintionProviderInterface
interface SortingDefinitionProviderInterface
{
/**
* @return \Ibexa\Contracts\Search\SortingDefinition\SortingDefinitionInterface[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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'
);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/SortingDefinition/SortingDefinitionRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
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;

/** @var \Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider&\PHPUnit\Framework\MockObject\MockObject */
private RepositoryConfigurationProvider $configurationProvider;

private NameSortingDefintionProvider $provider;
private NameSortingDefinitionProvider $provider;

protected function setUp(): void
{
Expand All @@ -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
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testGetSortingDefinitionsWithScoringCapability(): void
[
new SortingDefinition(
'relevance',
'sort_defintion.relevance.label',
'sort_definition.relevance.label',
[
new Score(Query::SORT_DESC),
],
Expand All @@ -73,7 +73,7 @@ public function testGetSortingDefinitionsWithoutScoringCapability(): void
[
new SortingDefinition(
'relevance',
'sort_defintion.relevance.label',
'sort_definition.relevance.label',
[
new DateModified(Query::SORT_DESC),
],
Expand Down
6 changes: 3 additions & 3 deletions tests/lib/SortingDefinition/SortingDefinitionRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0fbe8cc

Please sign in to comment.