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

Public Member Functions

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

Detailed Description

The purpose of this test is validating schema reader operations.

Definition at line 23 of file DataPatchInstallationTest.php.

Member Function Documentation

◆ setUp()

setUp ( )

Definition at line 50 of file DataPatchInstallationTest.php.

51  {
53  $this->moduleManager = $objectManager->get(TestModuleManager::class);
54  $this->cliCommad = $objectManager->get(CliCommand::class);
55  $this->moduleResource = $objectManager->get(ModuleResource::class);
56  $this->patchList = $objectManager->get(PatchHistory::class);
57  $this->tableData = $objectManager->get(TableData::class);
58  }
$objectManager
Definition: bootstrap.php:17

◆ testCyclomaticDependency()

testCyclomaticDependency ( )

@moduleName Magento_TestSetupDeclarationModule3 @expectedException \Magento\Framework\Exception\LocalizedException

Test whether installation give the same result as upgrade

Definition at line 98 of file DataPatchInstallationTest.php.

99  {
100  $this->moduleManager->updateRevision(
101  'Magento_TestSetupDeclarationModule3',
102  'cyclomatic_and_bic_revision',
103  'module.xml',
104  'etc'
105  );
106 
107  $this->movePatches();
111  $this->cliCommad->install(
112  ['Magento_TestSetupDeclarationModule3']
113  );
114  $tableData = $this->tableData->describeTableData('test_table');
115  self::assertEquals($this->getTestTableData(), $tableData);
116  $this->moduleManager->updateRevision(
117  'Magento_TestSetupDeclarationModule3',
118  'cyclomatic_and_bic_revision',
119  'BicPatch.php',
120  'Setup/Patch/Data'
121  );
122  $this->moduleManager->updateRevision(
123  'Magento_TestSetupDeclarationModule3',
124  'cyclomatic_and_bic_revision',
125  'RefBicPatch.php',
126  'Setup/Patch/Data'
127  );
128 
129  $this->cliCommad->upgrade();
130  }

◆ testDataPatchesInstallation()

testDataPatchesInstallation ( )

@moduleName Magento_TestSetupDeclarationModule3

Definition at line 63 of file DataPatchInstallationTest.php.

64  {
65  $this->cliCommad->install(
66  ['Magento_TestSetupDeclarationModule3']
67  );
68 
69  self::assertEquals(
70  '0.0.1',
71  $this->moduleResource->getDataVersion('Magento_TestSetupDeclarationModule3')
72  );
73 
74  $this->moduleManager->updateRevision(
75  'Magento_TestSetupDeclarationModule3',
76  'first_patch_revision',
77  'module.xml',
78  'etc'
79  );
80  $this->movePatches();
82  $this->cliCommad->upgrade();
83  self::assertEquals(
84  '0.0.3',
85  $this->moduleResource->getDataVersion('Magento_TestSetupDeclarationModule3')
86  );
87  self::assertTrue($this->patchList->isApplied(IncrementalSomeIntegerPatch::class));
88  self::assertTrue($this->patchList->isApplied(ReferenceIncrementalSomeIntegerPatch::class));
89  self::assertTrue($this->patchList->isApplied(ZFirstPatch::class));
90  $tableData = $this->tableData->describeTableData('test_table');
91  self::assertEquals($this->getTestTableData(), $tableData);
92  }

◆ testPatchesRevert()

testPatchesRevert ( )

@moduleName Magento_TestSetupDeclarationModule3

Definition at line 163 of file DataPatchInstallationTest.php.

164  {
165  $this->movePatches();
166  $this->cliCommad->install(['Magento_TestSetupDeclarationModule3']);
167  $this->cliCommad->uninstallModule('Magento_TestSetupDeclarationModule3');
168  $testTableData = $this->tableData->describeTableData('test_table');
169  $patchListTableData = $this->tableData->describeTableData('patch_list');
170  self::assertEmpty($patchListTableData);
171  self::assertEmpty($testTableData);
172  $refTableData = $this->tableData->describeTableData('reference_table');
173  self::assertEquals($this->getRefTableData(), $refTableData);
174  }

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