Skip to content

Commit 68a5d87

Browse files
author
Sergii Kovalenko
committed
MAGETWO-87551: Convert existing data install/upgrade scripts
--fix SVC
1 parent aaa346e commit 68a5d87

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,18 @@ public function enableModule($moduleName)
7272
/**
7373
* Execute upgrade magento command.
7474
*
75+
* @param array $installParams
7576
* @return string
7677
*/
77-
public function upgrade()
78+
public function upgrade($installParams = [])
7879
{
7980
$initParams = $this->parametersHolder->getInitParams();
80-
$enableModuleCommand = 'php -f ' . BP . '/bin/magento setup:upgrade -vvv -n --magento-init-params='
81+
$upgradeCommand = 'php -f ' . BP . '/bin/magento setup:upgrade -vvv -n --magento-init-params='
8182
. $initParams['magento-init-params'];
82-
return $this->shell->execute($enableModuleCommand);
83+
84+
$upgradeCommand .= ' ' . implode(" ", $this->toCliArguments(array_keys($installParams)));
85+
86+
return $this->shell->execute($upgradeCommand, array_values($installParams));
8387
}
8488

8589
/**

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ public function testInstallation()
5353
{
5454
$testTableData = $this->getData();
5555
$row = reset($testTableData);
56-
$this->cliCommad->install(
57-
['Magento_TestSetupDeclarationModule4']
58-
);
56+
$this->cliCommad->install(['Magento_TestSetupDeclarationModule4']);
5957
$adapter = $this->resourceConnection->getConnection();
6058
$testTableName = $this->resourceConnection->getTableName('test_table');
6159
$adapter->insertArray(
@@ -70,15 +68,23 @@ public function testInstallation()
7068
'db_schema.xml',
7169
'etc'
7270
);
73-
$this->cliCommad->upgrade();
71+
$this->cliCommad->upgrade(
72+
[
73+
'--safe-mode' => true,
74+
]
75+
);
7476
//Move new db_schema.xml with restored title field
7577
$this->moduleManager->updateRevision(
7678
'Magento_TestSetupDeclarationModule4',
7779
'restore_title_column',
7880
'db_schema.xml',
7981
'etc'
8082
);
81-
$this->cliCommad->upgrade();
83+
$this->cliCommad->upgrade(
84+
[
85+
'--data-restore' => true,
86+
]
87+
);
8288
$testTableSelect = $adapter->select()->from($testTableName);
8389
self::assertEquals($testTableData, $adapter->fetchAll($testTableSelect));
8490
}

0 commit comments

Comments
 (0)