You are here

public function BlazyAdminUnitTest::testBlazyAdminCreate in Blazy 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/Form/BlazyAdminUnitTest.php \Drupal\Tests\blazy\Unit\Form\BlazyAdminUnitTest::testBlazyAdminCreate()

@covers ::create @covers ::__construct @covers ::getEntityDisplayRepository @covers ::getTypedConfig @covers ::blazyManager

File

tests/src/Unit/Form/BlazyAdminUnitTest.php, line 38

Class

BlazyAdminUnitTest
Tests the Blazy admin form.

Namespace

Drupal\Tests\blazy\Unit\Form

Code

public function testBlazyAdminCreate() {
  $container = $this
    ->createMock(ContainerInterface::class);
  $exception = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
  $map = [
    [
      'entity_display.repository',
      $exception,
      $this->entityDisplayRepository,
    ],
    [
      'config.typed',
      $exception,
      $this->typedConfig,
    ],
    [
      'blazy.manager',
      $exception,
      $this->blazyManager,
    ],
  ];
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);
  $blazyAdmin = BlazyAdmin::create($container);
  $this
    ->assertInstanceOf(BlazyAdmin::class, $blazyAdmin);
  $this
    ->assertInstanceOf('\\Drupal\\Core\\Entity\\EntityDisplayRepositoryInterface', $blazyAdmin
    ->getEntityDisplayRepository());
  $this
    ->assertInstanceOf('\\Drupal\\Core\\Config\\TypedConfigManagerInterface', $blazyAdmin
    ->getTypedConfig());
  $this
    ->assertInstanceOf('\\Drupal\\blazy\\BlazyManagerInterface', $blazyAdmin
    ->blazyManager());
}