Skip to content

Commit 3c169d1

Browse files
author
Sergii Kovalenko
committed
MAGETWO-87928: Implement infrastructure for safe-rollback feature
--create dummy module
1 parent de3f3b2 commit 3c169d1

File tree

6 files changed

+153
-0
lines changed

6 files changed

+153
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:setup:Model/Declaration/Schema/etc/schema.xsd">
10+
<table name="test_table" resource="default" comment="Test Table">
11+
<column xsi:type="int" name="page_id" />
12+
<column xsi:type="varchar" name="email" />
13+
<column xsi:type="varchar" name="title" />
14+
<constraint xsi:type="primary" name="PRIMARY">
15+
<column name="page_id" />
16+
<column name="email" />
17+
</constraint>
18+
</table>
19+
</schema>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"test_table": {
3+
"column": {
4+
"page_id": true,
5+
"email": true,
6+
"title": true
7+
}
8+
}
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9+
<module name="Magento_TestSetupDeclarationModule4" />
10+
</config>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
return [
7+
[
8+
'page_id' => 1,
9+
'email' => '[email protected]',
10+
'title' => 'Title1'
11+
],
12+
[
13+
'page_id' => 2,
14+
'email' => '[email protected]',
15+
'title' => 'Title2'
16+
],
17+
[
18+
'page_id' => 3,
19+
'email' => '[email protected]',
20+
'title' => 'Title3'
21+
],
22+
[
23+
'page_id' => 4,
24+
'email' => '[email protected]',
25+
'title' => 'Title4'
26+
]
27+
];
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
use Magento\Framework\Component\ComponentRegistrar;
8+
9+
$registrar = new ComponentRegistrar();
10+
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestSetupDeclarationModule1') === null) {
11+
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestSetupDeclarationModule1', __DIR__);
12+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Setup;
8+
9+
use Magento\Framework\App\ResourceConnection;
10+
use Magento\Setup\Model\Declaration\Schema\Diff\SchemaDiff;
11+
use Magento\Setup\Model\Declaration\Schema\SchemaConfigInterface;
12+
use Magento\Setup\Model\Declaration\Schema\Sharding;
13+
use Magento\TestFramework\Deploy\CliCommand;
14+
use Magento\TestFramework\Deploy\DescribeTable;
15+
use Magento\TestFramework\Deploy\TestModuleManager;
16+
use Magento\TestFramework\Helper\Bootstrap;
17+
use Magento\TestFramework\TestCase\SetupTestCase;
18+
19+
/**
20+
* The purpose of this test is verifying safe declarative installation works.
21+
*/
22+
class SafeInstallerTest extends SetupTestCase
23+
{
24+
/**
25+
* @var TestModuleManager
26+
*/
27+
private $moduleManager;
28+
29+
/**
30+
* @var CliCommand
31+
*/
32+
private $cliCommad;
33+
34+
/**
35+
* @var SchemaDiff
36+
*/
37+
private $schemaDiff;
38+
39+
/**
40+
* @var SchemaConfigInterface
41+
*/
42+
private $schemaConfig;
43+
44+
/**
45+
* @var ResourceConnection
46+
*/
47+
private $resourceConnection;
48+
49+
/**
50+
* @var DescribeTable
51+
*/
52+
private $describeTable;
53+
54+
public function setUp()
55+
{
56+
$objectManager = Bootstrap::getObjectManager();
57+
$this->moduleManager = $objectManager->get(TestModuleManager::class);
58+
$this->cliCommad = $objectManager->get(CliCommand::class);
59+
$this->describeTable = $objectManager->get(DescribeTable::class);
60+
$this->schemaDiff = $objectManager->get(SchemaDiff::class);
61+
$this->schemaConfig = $objectManager->get(SchemaConfigInterface::class);
62+
$this->resourceConnection = $objectManager->get(ResourceConnection::class);
63+
}
64+
65+
/**
66+
* @moduleName Magento_TestSetupDeclarationModule1
67+
* @dataProviderFromFile Magento/TestSetupDeclarationModule1/fixture/declarative_installer/installation.php
68+
*/
69+
public function testInstallation()
70+
{
71+
$this->cliCommad->install(
72+
['Magento_TestSetupDeclarationModule1']
73+
);
74+
75+
}
76+
}

0 commit comments

Comments
 (0)