You are here

trait BlazyKernelTestTrait in Blazy 8.2

Same name and namespace in other branches
  1. 8 tests/src/Traits/BlazyKernelTestTrait.php \Drupal\Tests\blazy\Traits\BlazyKernelTestTrait

A trait common for Kernel tests.

Hierarchy

2 files declare their use of BlazyKernelTestTrait
BlazyKernelTestBase.php in tests/src/Kernel/BlazyKernelTestBase.php
BlazyViewsTestBase.php in tests/src/Kernel/Views/BlazyViewsTestBase.php

File

tests/src/Traits/BlazyKernelTestTrait.php, line 8

Namespace

Drupal\Tests\blazy\Traits
View source
trait BlazyKernelTestTrait {
  use BlazyUnitTestTrait;
  use BlazyCreationTestTrait;

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * Setup common Kernel classes.
   */
  protected function setUpKernelInstall() {
    $this
      ->installConfig([
      'field',
      'image',
      'responsive_image',
      'node',
      'views',
      'blazy',
    ]);
    $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('media');

    // @todo $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->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->blazyOembed = $this->container
      ->get('blazy.oembed');
    $this->blazyEntity = $this->container
      ->get('blazy.entity');
    $this->BlazyFormatter = $this->container
      ->get('blazy.formatter');
    $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();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlazyCreationTestTrait::$nodeType protected property Testing node type.
BlazyCreationTestTrait::buildEntityReferenceRenderArray protected function Sets field values as built by FieldItemListInterface::view().
BlazyCreationTestTrait::collectRenderDisplay protected function Sets field values as built by FieldItemListInterface::view().
BlazyCreationTestTrait::createDummyImage protected function Returns the created image file.
BlazyCreationTestTrait::createReferencingEntity protected function Create referencing entity.
BlazyCreationTestTrait::getBlazyFieldDefinition protected function Gets the field definition.
BlazyCreationTestTrait::getBlazyFieldStorageDefinition protected function Gets the field storage configuration.
BlazyCreationTestTrait::getFormatterInstance protected function Returns the field formatter instance.
BlazyCreationTestTrait::getImagePath protected function Returns path to the stored image location.
BlazyCreationTestTrait::prepareTestDirectory protected function Prepares test directory to store screenshots, or images.
BlazyCreationTestTrait::setUpContentTypeTest protected function Build dummy content types.
BlazyCreationTestTrait::setUpContentWithEntityReference protected function Build dummy contents with entity references.
BlazyCreationTestTrait::setUpContentWithItems protected function Build dummy nodes with optional fields.
BlazyCreationTestTrait::setUpFieldConfig protected function Setup a new image field.
BlazyCreationTestTrait::setUpFormatterDisplay protected function Setup formatter displays, default to image, and update its settings.
BlazyCreationTestTrait::setUpRealImage protected function Set up dummy image.
BlazyKernelTestTrait::$defaultTheme protected property
BlazyKernelTestTrait::setUpKernelInstall protected function Setup common Kernel classes.
BlazyKernelTestTrait::setUpKernelManager protected function Setup common Kernel manager classes.
BlazyPropertiesTestTrait::$blazyAdmin protected property The blazy admin service.
BlazyPropertiesTestTrait::$blazyAdminFormatter protected property The blazy admin service.
BlazyPropertiesTestTrait::$blazyEntity protected property The blazy entity service.
BlazyPropertiesTestTrait::$blazyManager protected property The blazy manager service.
BlazyPropertiesTestTrait::$bundle protected property The bundle name.
BlazyPropertiesTestTrait::$display protected property The entity display.
BlazyPropertiesTestTrait::$entities protected property The entity.
BlazyPropertiesTestTrait::$entity protected property The entity.
BlazyPropertiesTestTrait::$entityFieldManager protected property The entity manager.
BlazyPropertiesTestTrait::$entityPluginId protected property The tested entity reference formatter ID.
BlazyPropertiesTestTrait::$entityType protected property The tested entity type.
BlazyPropertiesTestTrait::$filterFormatFull protected property The filter format.
BlazyPropertiesTestTrait::$filterFormatRestricted protected property The filter format.
BlazyPropertiesTestTrait::$formatterDefinition protected property The formatter definition.
BlazyPropertiesTestTrait::$formatterPluginManager protected property The formatter plugin manager.
BlazyPropertiesTestTrait::$image protected property The created image item.
BlazyPropertiesTestTrait::$maxItems protected property The maximum number of created images.
BlazyPropertiesTestTrait::$maxParagraphs protected property The maximum number of created paragraphs.
BlazyPropertiesTestTrait::$node protected property The node entity.
BlazyPropertiesTestTrait::$referencedEntity protected property The referenced node entity.
BlazyPropertiesTestTrait::$referencingEntity protected property The node entity.
BlazyPropertiesTestTrait::$skins protected property The tested skins.
BlazyPropertiesTestTrait::$targetBundles protected property The target bundle names.
BlazyPropertiesTestTrait::$testEmptyName protected property The tested empty field name.
BlazyPropertiesTestTrait::$testEmptyType protected property The tested empty field type.
BlazyPropertiesTestTrait::$testFieldName protected property The tested field name.
BlazyPropertiesTestTrait::$testFieldType protected property The tested field type.
BlazyPropertiesTestTrait::$testItem protected property The created item.
BlazyPropertiesTestTrait::$testItems protected property The created items.
BlazyPropertiesTestTrait::$testPluginId protected property The tested formatter ID.
BlazyPropertiesTestTrait::$typeDefinition protected property The tested type definitions.
BlazyUnitTestTrait::$formatterSettings protected property The formatter settings.
BlazyUnitTestTrait::doPreRenderImage protected function Pre render Blazy image.
BlazyUnitTestTrait::getCacheMetaData protected function Return dummy cache metadata.
BlazyUnitTestTrait::getDefaulEntityFormatterDefinition protected function Returns the default field formatter definition.
BlazyUnitTestTrait::getDefaultFieldDefinition protected function Returns the default field definition.
BlazyUnitTestTrait::getDefaultFields protected function Returns dummy fields for an entity reference.
BlazyUnitTestTrait::getDefaultFormatterDefinition protected function Returns the default field formatter definition.
BlazyUnitTestTrait::getFormatterDefinition protected function Returns the field formatter definition along with settings.
BlazyUnitTestTrait::getFormatterSettings protected function Returns sensible formatter settings for testing purposes.
BlazyUnitTestTrait::setFormatterDefinition protected function Sets the field formatter definition.
BlazyUnitTestTrait::setFormatterSetting protected function Sets formatter setting.
BlazyUnitTestTrait::setFormatterSettings protected function Sets formatter settings.
BlazyUnitTestTrait::setUpMockImage protected function Setup the unit images.
BlazyUnitTestTrait::setUpUnitImages protected function Setup the unit images.
BlazyUnitTestTrait::setUpVariables protected function Set up Blazy variables.