You are here

protected function BlazyAdminFormatterUnitTest::setUp in Blazy 8

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

Overrides UnitTestCase::setUp

File

tests/src/Unit/Form/BlazyAdminFormatterUnitTest.php, line 33

Class

BlazyAdminFormatterUnitTest
Tests the Blazy admin formatter form.

Namespace

Drupal\Tests\blazy\Unit\Form

Code

protected function setUp() {
  parent::setUp();
  $this
    ->setUpUnitServices();
  $this
    ->setUpUnitContainer();
  $this->stringTranslation = $this
    ->createMock('Drupal\\Core\\StringTranslation\\TranslationInterface');
  $this->entityDisplayRepository = $this
    ->createMock('Drupal\\Core\\Entity\\EntityDisplayRepositoryInterface');
  $this->typedConfig = $this
    ->createMock('Drupal\\Core\\Config\\TypedConfigManagerInterface');
  $this->dateFormatter = $this
    ->getMockBuilder('Drupal\\Core\\Datetime\\DateFormatter')
    ->disableOriginalConstructor()
    ->getMock();
  $container = new ContainerBuilder();
  $container
    ->set('entity_display.repository', $this->entityDisplayRepository);
  $container
    ->set('config.typed', $this->typedConfig);
  $container
    ->set('string_translation', $this
    ->getStringTranslationStub());
  $container
    ->set('date.formatter', $this->dateFormatter);
  \Drupal::setContainer($container);
  $this->blazyAdminFormatter = new BlazyAdminFormatter($this->entityDisplayRepository, $this->typedConfig, $this->blazyManager);
}