You are here

BlazyKernelTestTrait.php in Blazy 8

Same filename and directory in other branches
  1. 8.2 tests/src/Traits/BlazyKernelTestTrait.php

File

tests/src/Traits/BlazyKernelTestTrait.php
View source
<?php

namespace Drupal\Tests\blazy\Traits;


/**
 * A trait common for Kernel tests.
 */
trait BlazyKernelTestTrait {
  use BlazyUnitTestTrait;
  use BlazyCreationTestTrait;

  /**
   * Setup common Kernel classes.
   */
  protected function setUpKernelInstall() {
    $this
      ->installConfig(static::$modules);
    $this
      ->installSchema('user', [
      'users_data',
    ]);
    $this
      ->installSchema('node', [
      'node_access',
    ]);
    $this
      ->installSchema('file', [
      'file_usage',
    ]);
    $this
      ->installEntitySchema('user');
    $this
      ->installEntitySchema('node');
    $this
      ->installEntitySchema('file');
    $this
      ->installEntitySchema('entity_test');
  }

  /**
   * Setup common Kernel manager classes.
   */
  protected function setUpKernelManager() {
    $this->root = $this->container
      ->get('app.root');
    $this->fileSystem = $this->container
      ->get('file_system');
    $this->entityManager = $this->container
      ->get('entity.manager');
    $this->entityFieldManager = $this->container
      ->get('entity_field.manager');
    $this->fieldTypePluginManager = $this->container
      ->get('plugin.manager.field.field_type');
    $this->formatterPluginManager = $this->container
      ->get('plugin.manager.field.formatter');
    $this->blazyManager = $this->container
      ->get('blazy.manager');
    $this->blazyFormatterManager = $this->container
      ->get('blazy.formatter.manager');
    $this->blazyAdminFormatter = $this->container
      ->get('blazy.admin.formatter');
    $this->blazyAdmin = $this->container
      ->get('blazy.admin');
    $this->blazyAdminExtended = $this->container
      ->get('blazy.admin.extended');

    // Enable Responsive image support.
    $this->blazyManager
      ->getConfigFactory()
      ->getEditable('blazy.settings')
      ->set('responsive_image', TRUE)
      ->save();
  }

}

Traits

Namesort descending Description
BlazyKernelTestTrait A trait common for Kernel tests.