From b88ecf83d7c7865141ade87eac55031475fe06c5 Mon Sep 17 00:00:00 2001 From: Maciej Date: Fri, 23 Jun 2023 08:13:21 +0200 Subject: [PATCH] OP-164 - adds tests for faq and section repositories --- .../test_it_finds_faq_by_code.yml | 57 +++++++++++++ .../test_it_finds_faq_by_position.yml | 57 +++++++++++++ .../test_it_finds_section_by_code.yml | 42 +++++++++ ...t_it_finds_section_by_codes_and_locale.yml | 42 +++++++++ .../test_it_finds_section_by_name.yml | 42 +++++++++ .../Repository/BlockRepositoryTest.php | 33 ++++--- .../FrequentlyAskedQuestionRepositoryTest.php | 73 ++++++++++++++++ .../Repository/MediaRepositoryTest.php | 22 ++--- .../Repository/PageRepositoryTest.php | 34 ++++---- .../Repository/SectionRepositoryTest.php | 85 +++++++++++++++++++ 10 files changed, 442 insertions(+), 45 deletions(-) create mode 100644 tests/Integration/DataFixtures/ORM/FrequentlyAskedQuestionRepositoryTest/test_it_finds_faq_by_code.yml create mode 100644 tests/Integration/DataFixtures/ORM/FrequentlyAskedQuestionRepositoryTest/test_it_finds_faq_by_position.yml create mode 100644 tests/Integration/DataFixtures/ORM/SectionRepositoryTest/test_it_finds_section_by_code.yml create mode 100644 tests/Integration/DataFixtures/ORM/SectionRepositoryTest/test_it_finds_section_by_codes_and_locale.yml create mode 100644 tests/Integration/DataFixtures/ORM/SectionRepositoryTest/test_it_finds_section_by_name.yml create mode 100644 tests/Integration/Repository/FrequentlyAskedQuestionRepositoryTest.php create mode 100644 tests/Integration/Repository/SectionRepositoryTest.php diff --git a/tests/Integration/DataFixtures/ORM/FrequentlyAskedQuestionRepositoryTest/test_it_finds_faq_by_code.yml b/tests/Integration/DataFixtures/ORM/FrequentlyAskedQuestionRepositoryTest/test_it_finds_faq_by_code.yml new file mode 100644 index 000000000..8394f9189 --- /dev/null +++ b/tests/Integration/DataFixtures/ORM/FrequentlyAskedQuestionRepositoryTest/test_it_finds_faq_by_code.yml @@ -0,0 +1,57 @@ +Sylius\Component\Addressing\Model\Country: + USA: + code: 'US' +Sylius\Component\Currency\Model\Currency: + dollar: + code: 'USD' +Sylius\Component\Locale\Model\Locale: + locale: + createdAt: '' + code: 'en_US' +Sylius\Component\Core\Model\Channel: + channel: + code: "code" + name: "name" + locales: + - '@locale' + default_locale: '@locale' + tax_calculation_strategy: 'order_items_based' + base_currency: '@dollar' +BitBag\SyliusCmsPlugin\Entity\FrequentlyAskedQuestionTranslation: + frequently_asked_question1_translation: + question: "How many days there are in one year?" + answer: "It may vary depending on whether you are working on a new question" + locale: 'en_US' + frequently_asked_question2_translation: + question: "Who is responsible for the translation" + answer: "Translators are" + locale: 'en_US' + frequently_asked_question3_translation: + question: "What is the date?" + answer: "Dunno" + locale: 'en_US' +BitBag\SyliusCmsPlugin\Entity\FrequentlyAskedQuestion: + frequently_asked_question1: + code: 'faq1-code' + enabled: true + position: 10 + channels: + - '@channel' + translations: + - '@frequently_asked_question1_translation' + frequently_asked_question2: + code: 'faq2-code' + enabled: true + position: 20 + channels: + - '@channel' + translations: + - '@frequently_asked_question2_translation' + frequently_asked_question3: + code: 'faq3-code' + enabled: false + position: 30 + channels: + - '@channel' + translations: + - '@frequently_asked_question3_translation' diff --git a/tests/Integration/DataFixtures/ORM/FrequentlyAskedQuestionRepositoryTest/test_it_finds_faq_by_position.yml b/tests/Integration/DataFixtures/ORM/FrequentlyAskedQuestionRepositoryTest/test_it_finds_faq_by_position.yml new file mode 100644 index 000000000..8394f9189 --- /dev/null +++ b/tests/Integration/DataFixtures/ORM/FrequentlyAskedQuestionRepositoryTest/test_it_finds_faq_by_position.yml @@ -0,0 +1,57 @@ +Sylius\Component\Addressing\Model\Country: + USA: + code: 'US' +Sylius\Component\Currency\Model\Currency: + dollar: + code: 'USD' +Sylius\Component\Locale\Model\Locale: + locale: + createdAt: '' + code: 'en_US' +Sylius\Component\Core\Model\Channel: + channel: + code: "code" + name: "name" + locales: + - '@locale' + default_locale: '@locale' + tax_calculation_strategy: 'order_items_based' + base_currency: '@dollar' +BitBag\SyliusCmsPlugin\Entity\FrequentlyAskedQuestionTranslation: + frequently_asked_question1_translation: + question: "How many days there are in one year?" + answer: "It may vary depending on whether you are working on a new question" + locale: 'en_US' + frequently_asked_question2_translation: + question: "Who is responsible for the translation" + answer: "Translators are" + locale: 'en_US' + frequently_asked_question3_translation: + question: "What is the date?" + answer: "Dunno" + locale: 'en_US' +BitBag\SyliusCmsPlugin\Entity\FrequentlyAskedQuestion: + frequently_asked_question1: + code: 'faq1-code' + enabled: true + position: 10 + channels: + - '@channel' + translations: + - '@frequently_asked_question1_translation' + frequently_asked_question2: + code: 'faq2-code' + enabled: true + position: 20 + channels: + - '@channel' + translations: + - '@frequently_asked_question2_translation' + frequently_asked_question3: + code: 'faq3-code' + enabled: false + position: 30 + channels: + - '@channel' + translations: + - '@frequently_asked_question3_translation' diff --git a/tests/Integration/DataFixtures/ORM/SectionRepositoryTest/test_it_finds_section_by_code.yml b/tests/Integration/DataFixtures/ORM/SectionRepositoryTest/test_it_finds_section_by_code.yml new file mode 100644 index 000000000..de388d554 --- /dev/null +++ b/tests/Integration/DataFixtures/ORM/SectionRepositoryTest/test_it_finds_section_by_code.yml @@ -0,0 +1,42 @@ +Sylius\Component\Addressing\Model\Country: + USA: + code: 'US' +Sylius\Component\Currency\Model\Currency: + dollar: + code: 'USD' +Sylius\Component\Locale\Model\Locale: + locale: + createdAt: '' + code: 'en_US' +Sylius\Component\Core\Model\Channel: + channel: + code: "code" + name: "name" + locales: + - '@locale' + default_locale: '@locale' + tax_calculation_strategy: 'order_items_based' + base_currency: '@dollar' +BitBag\SyliusCmsPlugin\Entity\SectionTranslation: + section1_translation: + name: 'translation1_name_en_US' + locale: 'en_US' + section2_translation: + name: 'translation2_name_en_US' + locale: 'en_US' + section3_translation: + name: 'translation3_name_en_US' + locale: 'en_US' +BitBag\SyliusCmsPlugin\Entity\Section: + section1: + code: 'section1-code' + translations: + - '@section1_translation' + section2: + code: 'section2-code' + translations: + - '@section2_translation' + section3: + code: 'section3-code' + translations: + - '@section3_translation' diff --git a/tests/Integration/DataFixtures/ORM/SectionRepositoryTest/test_it_finds_section_by_codes_and_locale.yml b/tests/Integration/DataFixtures/ORM/SectionRepositoryTest/test_it_finds_section_by_codes_and_locale.yml new file mode 100644 index 000000000..de388d554 --- /dev/null +++ b/tests/Integration/DataFixtures/ORM/SectionRepositoryTest/test_it_finds_section_by_codes_and_locale.yml @@ -0,0 +1,42 @@ +Sylius\Component\Addressing\Model\Country: + USA: + code: 'US' +Sylius\Component\Currency\Model\Currency: + dollar: + code: 'USD' +Sylius\Component\Locale\Model\Locale: + locale: + createdAt: '' + code: 'en_US' +Sylius\Component\Core\Model\Channel: + channel: + code: "code" + name: "name" + locales: + - '@locale' + default_locale: '@locale' + tax_calculation_strategy: 'order_items_based' + base_currency: '@dollar' +BitBag\SyliusCmsPlugin\Entity\SectionTranslation: + section1_translation: + name: 'translation1_name_en_US' + locale: 'en_US' + section2_translation: + name: 'translation2_name_en_US' + locale: 'en_US' + section3_translation: + name: 'translation3_name_en_US' + locale: 'en_US' +BitBag\SyliusCmsPlugin\Entity\Section: + section1: + code: 'section1-code' + translations: + - '@section1_translation' + section2: + code: 'section2-code' + translations: + - '@section2_translation' + section3: + code: 'section3-code' + translations: + - '@section3_translation' diff --git a/tests/Integration/DataFixtures/ORM/SectionRepositoryTest/test_it_finds_section_by_name.yml b/tests/Integration/DataFixtures/ORM/SectionRepositoryTest/test_it_finds_section_by_name.yml new file mode 100644 index 000000000..de388d554 --- /dev/null +++ b/tests/Integration/DataFixtures/ORM/SectionRepositoryTest/test_it_finds_section_by_name.yml @@ -0,0 +1,42 @@ +Sylius\Component\Addressing\Model\Country: + USA: + code: 'US' +Sylius\Component\Currency\Model\Currency: + dollar: + code: 'USD' +Sylius\Component\Locale\Model\Locale: + locale: + createdAt: '' + code: 'en_US' +Sylius\Component\Core\Model\Channel: + channel: + code: "code" + name: "name" + locales: + - '@locale' + default_locale: '@locale' + tax_calculation_strategy: 'order_items_based' + base_currency: '@dollar' +BitBag\SyliusCmsPlugin\Entity\SectionTranslation: + section1_translation: + name: 'translation1_name_en_US' + locale: 'en_US' + section2_translation: + name: 'translation2_name_en_US' + locale: 'en_US' + section3_translation: + name: 'translation3_name_en_US' + locale: 'en_US' +BitBag\SyliusCmsPlugin\Entity\Section: + section1: + code: 'section1-code' + translations: + - '@section1_translation' + section2: + code: 'section2-code' + translations: + - '@section2_translation' + section3: + code: 'section3-code' + translations: + - '@section3_translation' diff --git a/tests/Integration/Repository/BlockRepositoryTest.php b/tests/Integration/Repository/BlockRepositoryTest.php index 7a86aa240..fb6c10718 100644 --- a/tests/Integration/Repository/BlockRepositoryTest.php +++ b/tests/Integration/Repository/BlockRepositoryTest.php @@ -9,11 +9,10 @@ declare(strict_types=1); - namespace Tests\BitBag\SyliusCmsPlugin\Integration\Repository; use ApiTestCase\JsonApiTestCase; -use BitBag\SyliusCmsPlugin\Entity\Block; +use BitBag\SyliusCmsPlugin\Entity\BlockInterface; use BitBag\SyliusCmsPlugin\Repository\BlockRepositoryInterface; class BlockRepositoryTest extends JsonApiTestCase @@ -27,12 +26,10 @@ public function test_it_finds_enabled_block_by_code(): void { $this->loadFixturesFromFile('BlockRepositoryTest/test_it_finds_block_by_code.yml'); - /** @var BlockRepositoryInterface $blockRepostitory */ - $blockRepostitory = $this->getEntityManager()->getRepository(Block::class); - + $blockRepository = $this->getRepository(); - $block1 = $blockRepostitory->findEnabledByCode('block1-code', 'code'); - $block3 = $blockRepostitory->findEnabledByCode('block3-code', 'code'); + $block1 = $blockRepository->findEnabledByCode('block1-code', 'code'); + $block3 = $blockRepository->findEnabledByCode('block3-code', 'code'); self::assertNotNull($block1); self::assertNull($block3); @@ -42,12 +39,10 @@ public function test_it_finds_enabled_block_by_section_code(): void { $this->loadFixturesFromFile('BlockRepositoryTest/test_it_finds_block_by_section_code.yml'); - /** @var BlockRepositoryInterface $blockRepostitory */ - $blockRepostitory = $this->getEntityManager()->getRepository(Block::class); - + $blockRepository = $this->getRepository(); - $block_array1 = $blockRepostitory->findBySectionCode('section1-code', 'en_US', 'code'); - $block_array3 = $blockRepostitory->findBySectionCode('section3-code', 'en_US', 'code'); + $block_array1 = $blockRepository->findBySectionCode('section1-code', 'en_US', 'code'); + $block_array3 = $blockRepository->findBySectionCode('section3-code', 'en_US', 'code'); self::assertNotEmpty($block_array1); self::assertEmpty($block_array3); @@ -57,16 +52,20 @@ public function test_it_finds_enabled_block_by_product_code(): void { $this->loadFixturesFromFile('BlockRepositoryTest/test_it_finds_block_by_product_code.yml'); - /** @var BlockRepositoryInterface $blockRepostitory */ - $blockRepostitory = $this->getEntityManager()->getRepository(Block::class); + $blockRepository = $this->getRepository(); - - $block_array1 = $blockRepostitory->findByProductCode('MUG_SW', 'en_US', 'code'); - $block_array3 = $blockRepostitory->findByProductCode('MUG_SW3', 'en_US', 'code'); + $block_array1 = $blockRepository->findByProductCode('MUG_SW', 'en_US', 'code'); + $block_array3 = $blockRepository->findByProductCode('MUG_SW3', 'en_US', 'code'); self::assertNotEmpty($block_array1); self::assertEmpty($block_array3); } + private function getRepository(): BlockRepositoryInterface + { + /** @var BlockRepositoryInterface $repository */ + $repository = $this->getEntityManager()->getRepository(BlockInterface::class); + return $repository; + } } diff --git a/tests/Integration/Repository/FrequentlyAskedQuestionRepositoryTest.php b/tests/Integration/Repository/FrequentlyAskedQuestionRepositoryTest.php new file mode 100644 index 000000000..0d5510187 --- /dev/null +++ b/tests/Integration/Repository/FrequentlyAskedQuestionRepositoryTest.php @@ -0,0 +1,73 @@ +loadFixturesFromFile('FrequentlyAskedQuestionRepositoryTest//test_it_finds_faq_by_position.yml'); + + $localeCode = 'en_US'; + $channelCode = 'code'; + + $faqRepository = $this->getRepository(); + + $faqs = $faqRepository->findEnabledOrderedByPosition($localeCode, $channelCode); + + self::assertNotEmpty($faqs); + self::assertCount(2, $faqs); + + $previousPosition = null; + foreach ($faqs as $faq) { + if (null !== $previousPosition) { + self::assertGreaterThanOrEqual($previousPosition, $faq->getPosition()); + self::assertTrue($faq->isEnabled()); + } + $previousPosition = $faq->getPosition(); + } + } + + public function test_it_finds_enabled_frequently_asked_question_by_code(): void + { + $this->loadFixturesFromFile('FrequentlyAskedQuestionRepositoryTest/test_it_finds_faq_by_code.yml'); + + $faq1Code = 'faq1-code'; + $faq3Code = 'faq3-code'; + + $faqRepository = $this->getRepository(); + + $faq1 = $faqRepository->findOneEnabledByCode($faq1Code); + $faq3 = $faqRepository->findOneEnabledByCode($faq3Code); + + self::assertNotNull($faq1); + self::assertEquals($faq1Code, $faq1->getCode()); + self::assertTrue($faq1->isEnabled()); + self::assertNull($faq3); + } + + private function getRepository(): FrequentlyAskedQuestionRepositoryInterface + { + /** @var FrequentlyAskedQuestionRepositoryInterface $repository */ + $repository = $this->getEntityManager()->getRepository(FrequentlyAskedQuestionInterface::class); + + return $repository; + } +} diff --git a/tests/Integration/Repository/MediaRepositoryTest.php b/tests/Integration/Repository/MediaRepositoryTest.php index aad15aaef..1e1e31498 100644 --- a/tests/Integration/Repository/MediaRepositoryTest.php +++ b/tests/Integration/Repository/MediaRepositoryTest.php @@ -9,13 +9,10 @@ declare(strict_types=1); - namespace Tests\BitBag\SyliusCmsPlugin\Integration\Repository; use ApiTestCase\JsonApiTestCase; -use BitBag\SyliusCmsPlugin\Entity\Block; -use BitBag\SyliusCmsPlugin\Entity\Media; -use BitBag\SyliusCmsPlugin\Repository\BlockRepositoryInterface; +use BitBag\SyliusCmsPlugin\Entity\MediaInterface; use BitBag\SyliusCmsPlugin\Repository\MediaRepositoryInterface; class MediaRepositoryTest extends JsonApiTestCase @@ -29,8 +26,7 @@ public function test_it_finds_enabled_media_by_code(): void { $this->loadFixturesFromFile('MediaRepositoryTest/test_it_finds_media_by_code.yml'); - /** @var MediaRepositoryInterface $mediaRepository */ - $mediaRepository = $this->getEntityManager()->getRepository(Media::class); + $mediaRepository = $this->getRepository(); $media1 = $mediaRepository->findOneEnabledByCode('media1-code', 'en_US', 'code'); $media3 = $mediaRepository->findOneEnabledByCode('media3-code', 'en_US', 'code'); @@ -43,8 +39,7 @@ public function test_it_finds_enabled_media_by_section_code(): void { $this->loadFixturesFromFile('MediaRepositoryTest/test_it_finds_media_by_section_code.yml'); - /** @var MediaRepositoryInterface $mediaRepository */ - $mediaRepository = $this->getEntityManager()->getRepository(Media::class); + $mediaRepository = $this->getRepository(); $media1 = $mediaRepository->findBySectionCode('section1-code', 'en_US', 'code'); $media3 = $mediaRepository->findBySectionCode('section3-code', 'en_US', 'code'); @@ -57,8 +52,7 @@ public function test_it_finds_enabled_media_by_product_code(): void { $this->loadFixturesFromFile('MediaRepositoryTest/test_it_finds_media_by_product_code.yml'); - /** @var MediaRepositoryInterface $mediaRepository */ - $mediaRepository = $this->getEntityManager()->getRepository(Media::class); + $mediaRepository = $this->getRepository(); $media1_array = $mediaRepository->findByProductCode('MUG_SW', 'en_US', 'code'); $media3_array = $mediaRepository->findByProductCode('MUG_SW3', 'en_US', 'code'); @@ -66,4 +60,12 @@ public function test_it_finds_enabled_media_by_product_code(): void self::assertNotEmpty($media1_array); self::assertEmpty($media3_array); } + + private function getRepository(): MediaRepositoryInterface + { + /** @var MediaRepositoryInterface $repository */ + $repository = $this->getEntityManager()->getRepository(MediaInterface::class); + + return $repository; + } } diff --git a/tests/Integration/Repository/PageRepositoryTest.php b/tests/Integration/Repository/PageRepositoryTest.php index af6869748..2a18ed8ff 100644 --- a/tests/Integration/Repository/PageRepositoryTest.php +++ b/tests/Integration/Repository/PageRepositoryTest.php @@ -9,15 +9,10 @@ declare(strict_types=1); - namespace Tests\BitBag\SyliusCmsPlugin\Integration\Repository; use ApiTestCase\JsonApiTestCase; -use BitBag\SyliusCmsPlugin\Entity\Block; -use BitBag\SyliusCmsPlugin\Entity\Media; -use BitBag\SyliusCmsPlugin\Entity\Page; -use BitBag\SyliusCmsPlugin\Repository\BlockRepositoryInterface; -use BitBag\SyliusCmsPlugin\Repository\MediaRepositoryInterface; +use BitBag\SyliusCmsPlugin\Entity\PageInterface; use BitBag\SyliusCmsPlugin\Repository\PageRepositoryInterface; use Sylius\Component\Core\Model\Product; use Sylius\Component\Core\Repository\ProductRepositoryInterface; @@ -33,8 +28,7 @@ public function test_it_finds_enabled_pages(): void { $this->loadFixturesFromFile('PageRepositoryTest/test_it_finds_page_by_code.yml'); - /** @var PageRepositoryInterface $pageRepository */ - $pageRepository = $this->getEntityManager()->getRepository(Page::class); + $pageRepository = $this->getRepository(); $page1_2_array = $pageRepository->findEnabled(true); $page3_array = $pageRepository->findEnabled(false); @@ -47,8 +41,7 @@ public function test_it_finds_enabled_page_by_code(): void { $this->loadFixturesFromFile('PageRepositoryTest/test_it_finds_page_by_code.yml'); - /** @var PageRepositoryInterface $pageRepository */ - $pageRepository = $this->getEntityManager()->getRepository(Page::class); + $pageRepository = $this->getRepository(); $page1 = $pageRepository->findOneEnabledByCode('page1-code', 'en_US'); $page3 = $pageRepository->findOneEnabledByCode('page3-code', 'en_US'); @@ -61,8 +54,7 @@ public function test_it_finds_enabled_page_by_section_code(): void { $this->loadFixturesFromFile('PageRepositoryTest/test_it_finds_page_by_section_code.yml'); - /** @var PageRepositoryInterface $pageRepository */ - $pageRepository = $this->getEntityManager()->getRepository(Page::class); + $pageRepository = $this->getRepository(); $page1_array = $pageRepository->findBySectionCode('section1-code', 'en_US'); $page3_array = $pageRepository->findBySectionCode('section3-code', 'en_US'); @@ -75,8 +67,7 @@ public function test_it_finds_enabled_page_by_product(): void { $this->loadFixturesFromFile('PageRepositoryTest/test_it_finds_page_by_product.yml'); - /** @var PageRepositoryInterface $pageRepository */ - $pageRepository = $this->getEntityManager()->getRepository(Page::class); + $pageRepository = $this->getRepository(); /** @var ProductRepositoryInterface $productRepository */ $productRepository = $this->getEntityManager()->getRepository(Product::class); @@ -97,8 +88,7 @@ public function test_it_finds_enabled_page_by_product_and_section_code(): void { $this->loadFixturesFromFile('PageRepositoryTest/test_it_finds_page_by_product_and_section_code.yml'); - /** @var PageRepositoryInterface $pageRepository */ - $pageRepository = $this->getEntityManager()->getRepository(Page::class); + $pageRepository = $this->getRepository(); /** @var ProductRepositoryInterface $productRepository */ $productRepository = $this->getEntityManager()->getRepository(Product::class); @@ -108,10 +98,18 @@ public function test_it_finds_enabled_page_by_product_and_section_code(): void /** @var Product $product3 */ $product3 = $productRepository->findOneByCode('MUG_SW3'); - $page1_array = $pageRepository->findByProductAndSectionCode($product1, 'section1-code','code', null); - $page3_array = $pageRepository->findByProductAndSectionCode($product3, 'section3-code','code', null); + $page1_array = $pageRepository->findByProductAndSectionCode($product1, 'section1-code', 'code', null); + $page3_array = $pageRepository->findByProductAndSectionCode($product3, 'section3-code', 'code', null); self::assertNotEmpty($page1_array); self::assertEmpty($page3_array); } + + private function getRepository(): PageRepositoryInterface + { + /** @var PageRepositoryInterface $repository */ + $repository = $this->getEntityManager()->getRepository(PageInterface::class); + + return $repository; + } } diff --git a/tests/Integration/Repository/SectionRepositoryTest.php b/tests/Integration/Repository/SectionRepositoryTest.php new file mode 100644 index 000000000..446290dd4 --- /dev/null +++ b/tests/Integration/Repository/SectionRepositoryTest.php @@ -0,0 +1,85 @@ +getRepository(); + + $localeCode = 'en_US'; + $queryBuilder = $repository->createListQueryBuilder($localeCode); + + self::assertInstanceOf(QueryBuilder::class, $queryBuilder); + self::assertNotNull($queryBuilder->getQuery()); + } + + public function test_it_finds_section_by_name_part(): void + { + $this->loadFixturesFromFile('SectionRepositoryTest/test_it_finds_section_by_name.yml'); + + $repository = $this->getRepository(); + + $phrase = 'translation'; + $locale = 'en_US'; + $sections = $repository->findByNamePart($phrase, $locale); + + self::assertIsArray($sections); + self::assertCount(3, $sections); + } + + public function test_it_finds_one_by_code(): void + { + $this->loadFixturesFromFile('SectionRepositoryTest/test_it_finds_section_by_code.yml'); + + $repository = $this->getRepository(); + + $code = 'section1-code'; + $localeCode = 'en_US'; + $section = $repository->findOneByCode($code, $localeCode); + + self::assertInstanceOf(SectionInterface::class, $section); + } + + public function test_it_finds_by_codes_and_locale(): void + { + $this->loadFixturesFromFile('SectionRepositoryTest/test_it_finds_section_by_codes_and_locale.yml'); + + $repository = $this->getRepository(); + + $codes = 'section1-code,section2-code'; + $localeCode = 'en_US'; + $sections = $repository->findByCodesAndLocale($codes, $localeCode); + + self::assertIsArray($sections); + self::assertCount(2, $sections); + } + + private function getRepository(): SectionRepositoryInterface + { + /** @var SectionRepositoryInterface $repository */ + $repository = $this->getEntityManager()->getRepository(SectionInterface::class); + + return $repository; + } +}