function ConsoleTest::testSubdirectoryCommand

Same name and namespace in other branches
  1. main core/tests/Drupal/KernelTests/Core/Console/ConsoleTest.php \Drupal\KernelTests\Core\Console\ConsoleTest::testSubdirectoryCommand()

Tests running a console command defined in a subdirectory.

File

core/tests/Drupal/KernelTests/Core/Console/ConsoleTest.php, line 112

Class

ConsoleTest
Tests integration with Symfony Console.

Namespace

Drupal\KernelTests\Core\Console

Code

public function testSubdirectoryCommand() : void {
  $tester = $this->applicationTester();
  $code = $tester->run([
    'command' => 'example:sub:command',
  ], [
    'capture_stderr_separately' => TRUE,
  ]);
  $this->assertEquals(Command::SUCCESS, $code, $tester->getErrorOutput());
  $this->assertStringContainsString('[OK] Done', $tester->getDisplay());
}

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