3 namespace Drupal\Tests\blazy\Unit\Form;
5 use Drupal\blazy\Form\BlazyAdmin;
6 use Drupal\Tests\UnitTestCase;
7 use Drupal\Tests\blazy\Traits\BlazyUnitTestTrait;
8 use Symfony\Component\DependencyInjection\ContainerInterface;
11 * Tests the Blazy admin form.
13 * @coversDefaultClass \Drupal\blazy\Form\BlazyAdmin
16 class BlazyAdminUnitTest extends UnitTestCase {
18 use BlazyUnitTestTrait;
23 protected function setUp() {
26 $this->entityDisplayRepository = $this->getMock('\Drupal\Core\Entity\EntityDisplayRepositoryInterface');
27 $this->typedConfig = $this->getMock('\Drupal\Core\Config\TypedConfigManagerInterface');
28 $this->blazyManager = $this->getMock('\Drupal\blazy\BlazyManagerInterface');
33 * @covers ::__construct
34 * @covers ::getEntityDisplayRepository
35 * @covers ::getTypedConfig
36 * @covers ::blazyManager
38 public function testBlazyAdminCreate() {
39 $container = $this->getMock(ContainerInterface::class);
40 $exception = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
43 ['entity_display.repository', $exception, $this->entityDisplayRepository],
44 ['config.typed', $exception, $this->typedConfig],
45 ['blazy.manager', $exception, $this->blazyManager],
48 $container->expects($this->any())
50 ->willReturnMap($map);
52 $blazyAdmin = BlazyAdmin::create($container);
53 $this->assertInstanceOf(BlazyAdmin::class, $blazyAdmin);
55 $this->assertInstanceOf('\Drupal\Core\Entity\EntityDisplayRepositoryInterface', $blazyAdmin->getEntityDisplayRepository());
56 $this->assertInstanceOf('\Drupal\Core\Config\TypedConfigManagerInterface', $blazyAdmin->getTypedConfig());
57 $this->assertInstanceOf('\Drupal\blazy\BlazyManagerInterface', $blazyAdmin->blazyManager());