function ExtensionUninstallCommandTest::testDeclinedPromptAborts

Tests that declining the prompt throws a UserAbortException.

File

core/tests/Drupal/KernelTests/Core/Extension/Command/ExtensionUninstallCommandTest.php, line 104

Class

ExtensionUninstallCommandTest
Tests the 'ex:uninstall' command.

Namespace

Drupal\KernelTests\Core\Extension\Command

Code

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

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