You are here

trait EnvironmentTestTrait in Build Hooks 8.2

Same name and namespace in other branches
  1. 3.x tests/src/Traits/EnvironmentTestTrait.php \Drupal\Tests\build_hooks\Traits\EnvironmentTestTrait

Defines a trait for creating an environment.

Hierarchy

2 files declare their use of EnvironmentTestTrait
DeploymentStorageHandlerTest.php in tests/src/Kernel/DeploymentStorageHandlerTest.php
DeploymentValidationTest.php in tests/src/Kernel/DeploymentValidationTest.php

File

tests/src/Traits/EnvironmentTestTrait.php, line 11

Namespace

Drupal\Tests\build_hooks\Traits
View source
trait EnvironmentTestTrait {

  /**
   * Test environment.
   *
   * @var \Drupal\build_hooks\Entity\FrontendEnvironmentInterface
   */
  protected $environment;

  /**
   * Creates a test environment.
   */
  protected function createTestEnvironment() {
    $this->environment = FrontendEnvironment::create([
      'id' => 'foo',
      'label' => $this
        ->randomMachineName(),
      'settings' => [],
      'plugin' => 'build_hooks_test',
      'deployment_strategy' => Trigger::DEPLOYMENT_STRATEGY_ENTITYSAVE,
    ]);
    $this->environment
      ->save();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EnvironmentTestTrait::$environment protected property Test environment.
EnvironmentTestTrait::createTestEnvironment protected function Creates a test environment.