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

Public Member Functions

 setUp ()
 
 testSuccessfullInstall ()
 
 testDataMixedMode ()
 
 testSkippedPatch ()
 
 testDataInstallationWithoutVersion ()
 
- Public Member Functions inherited from SetupTestCase
 setData (array $data)
 
 flushData ()
 
 getData ()
 

Detailed Description

The purpose of this test is to check whether patch changes in Magento are backward compatible

Definition at line 21 of file BCPatchTest.php.

Member Function Documentation

◆ setUp()

setUp ( )

Definition at line 48 of file BCPatchTest.php.

49  {
51  $this->moduleManager = $objectManager->get(TestModuleManager::class);
52  $this->cliCommand = $objectManager->get(CliCommand::class);
53  $this->dbVersionInfo = $objectManager->get(DbVersionInfo::class);
54  $this->tableData = $objectManager->get(TableData::class);
55  $this->moduleResource = $objectManager->get(ModuleResource::class);
56  }
$objectManager
Definition: bootstrap.php:17

◆ testDataInstallationWithoutVersion()

testDataInstallationWithoutVersion ( )

@moduleName Magento_TestSetupDeclarationModule5

Definition at line 128 of file BCPatchTest.php.

129  {
130  $this->moduleManager->updateRevision(
131  'Magento_TestSetupDeclarationModule5',
132  'module-without-version',
133  'module.xml',
134  'etc'
135  );
136  $this->cliCommand->install(['Magento_TestSetupDeclarationModule5']);
137  self::assertTrue($this->dbVersionInfo->isDataUpToDate('Magento_TestSetupDeclarationModule5'));
138  self::assertTrue($this->dbVersionInfo->isSchemaUpToDate('Magento_TestSetupDeclarationModule5'));
139  $this->moduleResource->setDataVersion('Magento_TestSetupDeclarationModule5', '1.0.2');
140  $this->moduleResource->setDataVersion('Magento_TestSetupDeclarationModule5', '1.0.2');
141  $this->moduleManager->updateRevision(
142  'Magento_TestSetupDeclarationModule5',
143  'old-scripts',
144  'UpgradeData.php',
145  'Setup'
146  );
147  $this->moduleManager->updateRevision(
148  'Magento_TestSetupDeclarationModule5',
149  'patches',
150  'SomePatch.php',
151  'Setup/Patch/Data'
152  );
153  $this->moduleManager->updateRevision(
154  'Magento_TestSetupDeclarationModule5',
155  'patches',
156  'SomeSkippedPatch.php',
157  'Setup/Patch/Data'
158  );
159  $this->cliCommand->upgrade();
160  self::assertTrue($this->dbVersionInfo->isDataUpToDate('Magento_TestSetupDeclarationModule5'));
161  self::assertTrue($this->dbVersionInfo->isSchemaUpToDate('Magento_TestSetupDeclarationModule5'));
162  //Old scripts should be skipped because we do not have version
163  self::assertEquals(
164  [],
165  $this->tableData->describeTableData('reference_table', 'some_integer')
166  );
167  self::assertEquals(
168  ['_ref'],
169  $this->tableData->describeTableData('test_table', 'varchar')
170  );
171  }

◆ testDataMixedMode()

testDataMixedMode ( )

@moduleName Magento_TestSetupDeclarationModule5

Definition at line 71 of file BCPatchTest.php.

72  {
73  $this->moduleManager->updateRevision(
74  'Magento_TestSetupDeclarationModule5',
75  'old-scripts',
76  'UpgradeData.php',
77  'Setup'
78  );
79  $this->moduleManager->updateRevision(
80  'Magento_TestSetupDeclarationModule5',
81  'patches',
82  'SomePatch.php',
83  'Setup/Patch/Data'
84  );
85 
86  $this->cliCommand->install(['Magento_TestSetupDeclarationModule5']);
87  self::assertTrue($this->dbVersionInfo->isDataUpToDate('Magento_TestSetupDeclarationModule5'));
88  self::assertTrue($this->dbVersionInfo->isSchemaUpToDate('Magento_TestSetupDeclarationModule5'));
89  self::assertEquals(
90  [6,12],
91  $this->tableData->describeTableData('reference_table', 'some_integer')
92  );
93  self::assertEquals(
94  ['_ref'],
95  $this->tableData->describeTableData('test_table', 'varchar')
96  );
97  }

◆ testSkippedPatch()

testSkippedPatch ( )

@moduleName Magento_TestSetupDeclarationModule5

Definition at line 102 of file BCPatchTest.php.

103  {
104  $this->moduleManager->updateRevision(
105  'Magento_TestSetupDeclarationModule5',
106  'patches',
107  'SomePatch.php',
108  'Setup/Patch/Data'
109  );
110  $this->moduleManager->updateRevision(
111  'Magento_TestSetupDeclarationModule5',
112  'patches',
113  'SomeSkippedPatch.php',
114  'Setup/Patch/Data'
115  );
116  $this->cliCommand->install(['Magento_TestSetupDeclarationModule5']);
117  self::assertTrue($this->dbVersionInfo->isDataUpToDate('Magento_TestSetupDeclarationModule5'));
118  self::assertTrue($this->dbVersionInfo->isSchemaUpToDate('Magento_TestSetupDeclarationModule5'));
119  self::assertEquals(
120  ['_ref'],
121  $this->tableData->describeTableData('test_table', 'varchar')
122  );
123  }

◆ testSuccessfullInstall()

testSuccessfullInstall ( )

@moduleName Magento_TestSetupDeclarationModule5

Definition at line 61 of file BCPatchTest.php.

62  {
63  $this->cliCommand->install(['Magento_TestSetupDeclarationModule5']);
64  self::assertTrue($this->dbVersionInfo->isDataUpToDate('Magento_TestSetupDeclarationModule5'));
65  self::assertTrue($this->dbVersionInfo->isSchemaUpToDate('Magento_TestSetupDeclarationModule5'));
66  }

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