Skip to content

Commit 90c4c37

Browse files
author
Sergii Kovalenko
committed
MAGETWO-88054: Move declarative setup from setup to framework
1 parent e2967bf commit 90c4c37

File tree

6 files changed

+31
-4
lines changed

6 files changed

+31
-4
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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_TestSetupDeclarationModule7" setup_version="2.0.2">
10+
<sequence>
11+
<module name="Magento_TestSetupDeclarationModule6" />
12+
</sequence>
13+
</module>
14+
</config>

dev/tests/setup-integration/framework/Magento/TestFramework/Annotation/ReinstallInstance.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
namespace Magento\TestFramework\Annotation;
88

9+
use Magento\Framework\Module\ModuleResource;
10+
911
/**
1012
* Handler for applying reinstallMagento annotation.
1113
*/
@@ -26,14 +28,20 @@ public function __construct(\Magento\TestFramework\Application $application)
2628
$this->application = $application;
2729
}
2830

31+
public function startTest()
32+
{
33+
$this->application->reinitialize();
34+
}
35+
2936
/**
3037
* Handler for 'endTest' event.
3138
*
3239
* @throws \Magento\Framework\Exception\LocalizedException
3340
*/
3441
public function endTest()
3542
{
36-
$this->application->reinitialize();
3743
$this->application->cleanup();
44+
$this->application->reinitialize();
45+
ModuleResource::flush();
3846
}
3947
}

dev/tests/setup-integration/testsuite/Magento/Setup/BCMultiModuleTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
namespace Magento\Setup;
88

99
use Magento\Framework\Module\DbVersionInfo;
10+
use Magento\Framework\Module\ModuleList;
1011
use Magento\Framework\Module\ModuleResource;
1112
use Magento\Framework\Setup\Declaration\Schema\Db\DbSchemaReaderInterface;
1213
use Magento\TestFramework\Deploy\CliCommand;
1314
use Magento\TestFramework\Deploy\TableData;
1415
use Magento\TestFramework\Deploy\TestModuleManager;
1516
use Magento\TestFramework\Helper\Bootstrap;
17+
use Magento\TestFramework\ObjectManager;
1618
use Magento\TestFramework\TestCase\SetupTestCase;
1719

1820
/**
@@ -60,6 +62,7 @@ public function setUp()
6062
$this->tableData = $objectManager->get(TableData::class);
6163
$this->moduleResource = $objectManager->get(ModuleResource::class);
6264
$this->dbSchemaReader = $objectManager->get(DbSchemaReaderInterface::class);
65+
6366
}
6467

6568
/**

dev/tests/setup-integration/testsuite/Magento/Setup/BCPatchTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public function setUp()
5353
$this->dbVersionInfo = $objectManager->get(DbVersionInfo::class);
5454
$this->tableData = $objectManager->get(TableData::class);
5555
$this->moduleResource = $objectManager->get(ModuleResource::class);
56-
$this->moduleResource->flush();
5756
}
5857

5958
/**

dev/tests/setup-integration/testsuite/Magento/Setup/DataPatchInstallationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function testDataPatchesInstallation()
7878
'etc'
7979
);
8080
$this->movePatches();
81-
$this->moduleResource->flush();
81+
ModuleResource::flush();
8282
$this->cliCommad->upgrade();
8383
self::assertEquals(
8484
'0.0.3',

lib/internal/Magento/Framework/Module/ModuleResource.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
/**
1212
* Resource Model
13+
*
14+
* @deprecated Declarative schema and data patches replace old functionality and setup_module table
15+
* So all resources related to this table, will be deprecated since 2.3.0
1316
*/
1417
class ModuleResource extends AbstractDb implements ResourceInterface
1518
{
@@ -140,7 +143,7 @@ public function setDataVersion($moduleName, $version)
140143
*
141144
* @return void
142145
*/
143-
public function flush()
146+
public static function flush()
144147
{
145148
self::$dataVersions = null;
146149
self::$schemaVersions = [];

0 commit comments

Comments
 (0)