trait DrupalApplicationTesterTrait

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/DrupalApplicationTesterTrait.php \Drupal\KernelTests\DrupalApplicationTesterTrait

Trait to help with testing the drupal console.

Hierarchy

2 files declare their use of DrupalApplicationTesterTrait
ConsoleTest.php in core/tests/Drupal/KernelTests/Core/Console/ConsoleTest.php
StatusCommandTest.php in core/modules/system/tests/src/Kernel/Command/StatusCommandTest.php

File

core/tests/Drupal/KernelTests/DrupalApplicationTesterTrait.php, line 13

Namespace

Drupal\KernelTests
View source
trait DrupalApplicationTesterTrait {
  use ComposerIntegrationTrait;
  
  /**
   * Build our ApplicationTester.
   */
  private function applicationTester(array $context = []) : ApplicationTester {
    $application = include static::binDir() . '/dr';
    $context['kernel.environment'] = 'testing';
    $context['kernel.allow_dumping'] = FALSE;
    $application = $application($context);
    $application->setAutoExit(FALSE);
    return new ApplicationTester($application);
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.