Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
SafeInstallerTest Class Reference
Inheritance diagram for SafeInstallerTest:
SetupTestCase MutableDataInterface

Public Member Functions

 setUp ()
 
 testInstallation ()
 
- Public Member Functions inherited from SetupTestCase
 setData (array $data)
 
 flushData ()
 
 getData ()
 

Detailed Description

The purpose of this test is verifying safe declarative installation works.

Definition at line 22 of file SafeInstallerTest.php.

Member Function Documentation

◆ setUp()

setUp ( )

Definition at line 39 of file SafeInstallerTest.php.

40  {
42  $this->moduleManager = $objectManager->get(TestModuleManager::class);
43  $this->cliCommad = $objectManager->get(CliCommand::class);
44  $this->resourceConnection = $objectManager->get(ResourceConnection::class);
45  }
$objectManager
Definition: bootstrap.php:17

◆ testInstallation()

testInstallation ( )

@moduleName Magento_TestSetupDeclarationModule4 @dataProviderFromFile Magento/TestSetupDeclarationModule4/fixture/safe_data_provider.php

Definition at line 51 of file SafeInstallerTest.php.

52  {
53  $testTableData = $this->getData();
54  $row = reset($testTableData);
55  $this->cliCommad->install(['Magento_TestSetupDeclarationModule4']);
56  $adapter = $this->resourceConnection->getConnection();
57  $testTableName = $this->resourceConnection->getTableName('test_table');
58  $adapter->insertArray(
59  $this->resourceConnection->getTableName('test_table'),
60  array_keys($row),
61  $this->getData()
62  );
63  //Move new db_schema.xml
64  $this->moduleManager->updateRevision(
65  'Magento_TestSetupDeclarationModule4',
66  'remove_title_column',
67  'db_schema.xml',
68  'etc'
69  );
70  $this->cliCommad->upgrade(
71  [
72  'safe-mode' => true,
73  ]
74  );
75  //Move new db_schema.xml with restored title field
76  $this->moduleManager->updateRevision(
77  'Magento_TestSetupDeclarationModule4',
78  'restore_title_column',
79  'db_schema.xml',
80  'etc'
81  );
82  $this->cliCommad->upgrade(
83  [
84  'data-restore' => true,
85  ]
86  );
87  $testTableSelect = $adapter->select()->from($testTableName);
88  self::assertEquals($testTableData, $adapter->fetchAll($testTableSelect));
89  }
$adapter
Definition: webapi_user.php:16

The documentation for this class was generated from the following file: