function ExtensionInstallCommandTest::testDeclinedPromptAborts

Same name in this branch
  1. main core/modules/system/tests/src/Kernel/Command/ExtensionInstallCommandTest.php \Drupal\Tests\system\Kernel\Command\ExtensionInstallCommandTest::testDeclinedPromptAborts()
Same name and namespace in other branches
  1. 11.x core/modules/system/tests/src/Kernel/Command/ExtensionInstallCommandTest.php \Drupal\Tests\system\Kernel\Command\ExtensionInstallCommandTest::testDeclinedPromptAborts()
  2. 11.x core/tests/Drupal/KernelTests/Core/Extension/Command/ExtensionInstallCommandTest.php \Drupal\KernelTests\Core\Extension\Command\ExtensionInstallCommandTest::testDeclinedPromptAborts()

Tests that declining the prompt throws a UserAbortException.

File

core/tests/Drupal/KernelTests/Core/Extension/Command/ExtensionInstallCommandTest.php, line 91

Class

ExtensionInstallCommandTest
Tests the 'ex:install' command.

Namespace

Drupal\KernelTests\Core\Extension\Command

Code

public function testDeclinedPromptAborts() : void {
  $tester = $this->commandTester();
  $tester->setInputs([
    'no',
  ]);
  try {
    $tester->execute([
      'extensions' => 'console_test',
    ], [
      'interactive' => TRUE,
    ]);
    $this->fail('Expected a UserAbortException to be thrown.');
  } catch (UserAbortException) {
    // Expected.
  }
  $this->assertFalse($this->moduleInstalled('console_test'));
  $this->assertFalse($this->moduleInstalled('autowire_test'));
}

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