function ExtensionInstallCommandTest::testDryRunInstallsNothing

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::testDryRunInstallsNothing()

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

File

core/modules/system/tests/src/Kernel/Command/ExtensionInstallCommandTest.php, line 60

Class

ExtensionInstallCommandTest
Tests the 'ex:install' command.

Namespace

Drupal\Tests\system\Kernel\Command

Code

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