Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DryRunTest.php
Go to the documentation of this file.
1 <?php
7 namespace Magento\Setup;
8 
14 
19 {
23  private $moduleManager;
24 
28  private $cliCommad;
29 
30  public function setUp()
31  {
33  $this->moduleManager = $objectManager->get(TestModuleManager::class);
34  $this->cliCommad = $objectManager->get(CliCommand::class);
35  }
36 
41  public function testDryRunOnCleanDatabase()
42  {
43  $logFileName = TESTS_TEMP_DIR . '/var/log/' . DryRunLogger::FILE_NAME;
44  $this->cliCommad->install(
45  ['Magento_TestSetupDeclarationModule1'],
46  ['dry-run' => true]
47  );
48  self::assertFileExists($logFileName);
49  $data = file_get_contents($logFileName);
50  self::assertEquals($data, $this->getData()[0]);
51  }
52 
57  public function testDryRunOnUpgrade()
58  {
59  $logFileName = TESTS_TEMP_DIR . '/var/log/' . DryRunLogger::FILE_NAME;
60  $this->cliCommad->install(['Magento_TestSetupDeclarationModule1']);
61  $this->moduleManager->updateRevision(
62  'Magento_TestSetupDeclarationModule1',
63  'column_modifications',
64  'db_schema.xml',
65  'etc'
66  );
67  $this->cliCommad->upgrade(['dry-run' => true]);
68  self::assertFileExists($logFileName);
69  $data = file_get_contents($logFileName);
70  self::assertEquals($data, $this->getData()[0]);
71  }
72 }
$objectManager
Definition: bootstrap.php:17