From 749598e3422045994835f9955c623ee55757dcfb Mon Sep 17 00:00:00 2001 From: David Buros Date: Fri, 26 Aug 2022 10:52:33 +0200 Subject: [PATCH] fix: rewrite tests to accepted channel named product index --- src/EventSubscriber/AppendProductAttributeMappingSubscriber.php | 2 +- .../Response/FilterBuilders/Product/AttributeFilterBuilder.php | 2 +- .../Response/FilterBuilders/Product/MainTaxonFilterBuilder.php | 2 +- .../Response/FilterBuilders/Product/OptionFilterBuilder.php | 2 +- .../Response/FilterBuilders/Product/PriceFilterBuilder.php | 2 +- .../Response/FilterBuilders/Product/TaxonsFilterBuilder.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/EventSubscriber/AppendProductAttributeMappingSubscriber.php b/src/EventSubscriber/AppendProductAttributeMappingSubscriber.php index e8034780..e5c154f2 100644 --- a/src/EventSubscriber/AppendProductAttributeMappingSubscriber.php +++ b/src/EventSubscriber/AppendProductAttributeMappingSubscriber.php @@ -46,7 +46,7 @@ public static function getSubscribedEvents() public function onMappingProvider(MappingProviderEvent $event): void { - if ('monsieurbiz_product' !== $event->getIndexCode()) { + if (false === (bool) preg_match('/monsieurbiz_product$/', $event->getIndexCode())) { return; } $mapping = $event->getMapping(); diff --git a/src/Search/Response/FilterBuilders/Product/AttributeFilterBuilder.php b/src/Search/Response/FilterBuilders/Product/AttributeFilterBuilder.php index 555518d8..6f91952e 100644 --- a/src/Search/Response/FilterBuilders/Product/AttributeFilterBuilder.php +++ b/src/Search/Response/FilterBuilders/Product/AttributeFilterBuilder.php @@ -26,7 +26,7 @@ public function build( string $aggregationCode, array $aggregationData ): ?array { - if ('monsieurbiz_product' !== $documentable->getIndexCode() || 'attributes' !== $aggregationCode) { + if (false === (bool) preg_match('/monsieurbiz_product$/', $documentable->getIndexCode()) || 'attributes' !== $aggregationCode) { return null; } diff --git a/src/Search/Response/FilterBuilders/Product/MainTaxonFilterBuilder.php b/src/Search/Response/FilterBuilders/Product/MainTaxonFilterBuilder.php index b6a739ab..d3c43cb2 100644 --- a/src/Search/Response/FilterBuilders/Product/MainTaxonFilterBuilder.php +++ b/src/Search/Response/FilterBuilders/Product/MainTaxonFilterBuilder.php @@ -26,7 +26,7 @@ public function build( string $aggregationCode, array $aggregationData ): ?array { - if ('monsieurbiz_product' !== $documentable->getIndexCode() || 'main_taxon' !== $aggregationCode) { + if (false === (bool) preg_match('/monsieurbiz_product$/', $documentable->getIndexCode()) || 'main_taxon' !== $aggregationCode) { return null; } diff --git a/src/Search/Response/FilterBuilders/Product/OptionFilterBuilder.php b/src/Search/Response/FilterBuilders/Product/OptionFilterBuilder.php index cf0de594..1d12c43c 100644 --- a/src/Search/Response/FilterBuilders/Product/OptionFilterBuilder.php +++ b/src/Search/Response/FilterBuilders/Product/OptionFilterBuilder.php @@ -26,7 +26,7 @@ public function build( string $aggregationCode, array $aggregationData ): ?array { - if ('monsieurbiz_product' !== $documentable->getIndexCode() || 'options' !== $aggregationCode) { + if (false === (bool) preg_match('/monsieurbiz_product$/', $documentable->getIndexCode()) || 'options' !== $aggregationCode) { return null; } diff --git a/src/Search/Response/FilterBuilders/Product/PriceFilterBuilder.php b/src/Search/Response/FilterBuilders/Product/PriceFilterBuilder.php index 38ddc5c6..edb34c4f 100644 --- a/src/Search/Response/FilterBuilders/Product/PriceFilterBuilder.php +++ b/src/Search/Response/FilterBuilders/Product/PriceFilterBuilder.php @@ -26,7 +26,7 @@ public function build( string $aggregationCode, array $aggregationData ): ?array { - if ('monsieurbiz_product' !== $documentable->getIndexCode() || 'prices' !== $aggregationCode) { + if (false === (bool) preg_match('/monsieurbiz_product$/', $documentable->getIndexCode()) || 'prices' !== $aggregationCode) { return null; } diff --git a/src/Search/Response/FilterBuilders/Product/TaxonsFilterBuilder.php b/src/Search/Response/FilterBuilders/Product/TaxonsFilterBuilder.php index 55a7753c..de2a8d23 100644 --- a/src/Search/Response/FilterBuilders/Product/TaxonsFilterBuilder.php +++ b/src/Search/Response/FilterBuilders/Product/TaxonsFilterBuilder.php @@ -25,7 +25,7 @@ public function build( string $aggregationCode, array $aggregationData ): ?array { - if ('monsieurbiz_product' !== $documentable->getIndexCode() || 'taxons' !== $aggregationCode) { + if (false === (bool) preg_match('/monsieurbiz_product$/', $documentable->getIndexCode()) || 'taxons' !== $aggregationCode) { return null; }