trait EnvironmentTestTrait in Build Hooks 8.2
Same name and namespace in other branches
- 3.x tests/src/Traits/EnvironmentTestTrait.php \Drupal\Tests\build_hooks\Traits\EnvironmentTestTrait
Defines a trait for creating an environment.
Hierarchy
- trait \Drupal\Tests\build_hooks\Traits\EnvironmentTestTrait
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\TraitsView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EnvironmentTestTrait:: |
protected | property | Test environment. | |
EnvironmentTestTrait:: |
protected | function | Creates a test environment. |