function ExtensionUninstallCommandTest::testDryRunUninstallsNothing

Tests that --dry-run lists the operations but uninstalls nothing.

File

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

Class

ExtensionUninstallCommandTest
Tests the 'ex:uninstall' command.

Namespace

Drupal\KernelTests\Core\Extension\Command

Code

public function testDryRunUninstallsNothing() : void {
  $tester = $this->commandTester();
  $code = $tester->execute([
    'extensions' => 'autowire_test',
    '--dry-run' => TRUE,
  ]);
  $display = $tester->getDisplay();
  $this->assertEquals(Command::SUCCESS, $code, $tester->getDisplay());
  // The requested module and its dependent are reported.
  $this->assertStringContainsString('autowire_test', $display);
  $this->assertStringContainsString('console_test', $display);
  $this->assertStringContainsString('Dry run', $display);
  // Nothing was actually uninstalled.
  $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.