Skip to content

Commit 4134c8c

Browse files
author
Oleksii Korshenko
committed
MAGETWO-82003: Ensure database is cleared/Magento reinstalled when TESTS_CLEANUP is enabled magento#11499
- Merge Pull Request magento#11499 from joshuaswarren/magento2:Integration-Test-Fix - Merged commits: 1. bd95e4e
2 parents 08ec8ce + bd95e4e commit 4134c8c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

dev/tests/integration/framework/Magento/TestFramework/Application.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ public function cleanup()
438438
* @return void
439439
* @throws \Magento\Framework\Exception\LocalizedException
440440
*/
441-
public function install()
441+
public function install($cleanup)
442442
{
443443
$dirs = \Magento\Framework\App\Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS;
444444
$this->_ensureDirExists($this->installDir);
@@ -453,8 +453,9 @@ public function install()
453453
$installParams = $this->getInstallCliParams();
454454

455455
// performance optimization: restore DB from last good dump to make installation on top of it (much faster)
456+
// do not restore from the database if the cleanup option is set to ensure we have a clean DB to test on
456457
$db = $this->getDbInstance();
457-
if ($db->isDbDumpExists()) {
458+
if ($db->isDbDumpExists() && !$cleanup) {
458459
$db->restoreFromDbDump();
459460
}
460461

dev/tests/integration/framework/bootstrap.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
$application->cleanup();
7575
}
7676
if (!$application->isInstalled()) {
77-
$application->install();
77+
$application->install($settings->getAsBoolean('TESTS_CLEANUP'));
7878
}
7979
$application->initialize([]);
8080

0 commit comments

Comments
 (0)