-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathFormEnumTranslationControllerTest.php
More file actions
45 lines (36 loc) · 1.57 KB
/
FormEnumTranslationControllerTest.php
File metadata and controls
45 lines (36 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
namespace EasyCorp\Bundle\EasyAdminBundle\Tests\Controller;
use Doctrine\ORM\EntityRepository;
use EasyCorp\Bundle\EasyAdminBundle\Test\AbstractCrudTestCase;
use EasyCorp\Bundle\EasyAdminBundle\Tests\Functional\Apps\DefaultApp\Controller\DashboardController;
use EasyCorp\Bundle\EasyAdminBundle\Tests\Functional\Apps\DefaultApp\Controller\Synthetic\FormEnumTranslationController;
use EasyCorp\Bundle\EasyAdminBundle\Tests\Functional\Apps\DefaultApp\Entity\BlogPost;
use EasyCorp\Bundle\EasyAdminBundle\Tests\Functional\Apps\DefaultApp\Enum\BlogPostStateEnum;
use Symfony\Contracts\Translation\TranslatorInterface;
class FormEnumTranslationControllerTest extends AbstractCrudTestCase
{
protected EntityRepository $blogPosts;
protected function setUp(): void
{
parent::setUp();
$this->client->followRedirects();
$this->blogPosts = $this->entityManager->getRepository(BlogPost::class);
}
protected function getControllerFqcn(): string
{
return FormEnumTranslationController::class;
}
protected function getDashboardFqcn(): string
{
return DashboardController::class;
}
public function testFieldsFormatValue()
{
$translator = static::getContainer()->get(TranslatorInterface::class);
static::assertInstanceOf(TranslatorInterface::class, $translator);
$this->client->request('GET', $this->generateNewFormUrl());
foreach (BlogPostStateEnum::cases() as $case) {
self::assertAnySelectorTextSame('option', $case->trans($translator, locale: 'en'));
}
}
}