-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
tests/Integration/DataFixtures/ORM/TemplateRepositoryTest/test_it_finds_template_by_name.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/* | ||
* This file has been created by developers from BitBag. | ||
* Feel free to contact us once you face any issues or want to start | ||
* You can find more information about us on https://bitbag.io and write us | ||
* an email on [email protected]. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\BitBag\SyliusCmsPlugin\Integration\Repository; | ||
|
||
use ApiTestCase\JsonApiTestCase; | ||
use BitBag\SyliusCmsPlugin\Entity\TemplateInterface; | ||
use BitBag\SyliusCmsPlugin\Repository\TemplateRepositoryInterface; | ||
|
||
class TemplateRepositoryTest extends JsonApiTestCase | ||
{ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
public function test_it_finds_media_by_name_part(): void | ||
{ | ||
$this->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; | ||
} | ||
} |