diff --git a/tests/Integration/DataFixtures/ORM/TemplateRepositoryTest/test_it_finds_template_by_name.yml b/tests/Integration/DataFixtures/ORM/TemplateRepositoryTest/test_it_finds_template_by_name.yml new file mode 100644 index 00000000..184c5df1 --- /dev/null +++ b/tests/Integration/DataFixtures/ORM/TemplateRepositoryTest/test_it_finds_template_by_name.yml @@ -0,0 +1,10 @@ +BitBag\SyliusCmsPlugin\Entity\Template: + template1: + name: 'template1-name' + type: 'page' + template2: + name: 'template2-name' + type: 'page' + template3: + name: 'template3-name' + type: 'page' diff --git a/tests/Integration/Repository/TemplateRepositoryTest.php b/tests/Integration/Repository/TemplateRepositoryTest.php new file mode 100644 index 00000000..5fc81abd --- /dev/null +++ b/tests/Integration/Repository/TemplateRepositoryTest.php @@ -0,0 +1,46 @@ +loadFixturesFromFile('TemplateRepositoryTest/test_it_finds_template_by_name.yml'); + + $repository = $this->getRepository(); + + $phrase = 'template'; + $type = 'page'; + $template = $repository->findTemplatesByNamePart($phrase, $type); + + self::assertIsArray($template); + self::assertCount(3, $template); + } + + private function getRepository(): TemplateRepositoryInterface + { + /** @var TemplateRepositoryInterface $repository */ + $repository = $this->getEntityManager()->getRepository(TemplateInterface::class); + + return $repository; + } +}