File tree Expand file tree Collapse file tree 4 files changed +12
-8
lines changed Expand file tree Collapse file tree 4 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,12 @@ public function run()
2626 /**
2727 * {@inheritdoc}
2828 */
29- public function install ()
29+ public function install ($ cleanup )
3030 {
31+ if ($ cleanup ) {
32+ $ this ->cleanup ();
33+ }
34+
3135 $ installOptions = $ this ->getInstallConfig ();
3236
3337 /* Install application */
Original file line number Diff line number Diff line change 5858 );
5959
6060 if (defined ('TESTS_MAGENTO_INSTALLATION ' ) && TESTS_MAGENTO_INSTALLATION === 'enabled ' ) {
61- if (defined ('TESTS_CLEANUP ' ) && TESTS_CLEANUP === 'enabled ' ) {
62- $ application ->cleanup ();
63- }
64- $ application ->install ();
61+ $ cleanup = (defined ('TESTS_CLEANUP ' ) && TESTS_CLEANUP === 'enabled ' );
62+ $ application ->install ($ cleanup );
6563 }
6664
6765 $ bootstrap = new \Magento \TestFramework \Bootstrap (
Original file line number Diff line number Diff line change @@ -435,10 +435,11 @@ public function cleanup()
435435 /**
436436 * Install an application
437437 *
438+ * @param bool $cleanup
438439 * @return void
439440 * @throws \Magento\Framework\Exception\LocalizedException
440441 */
441- public function install ()
442+ public function install ($ cleanup )
442443 {
443444 $ dirs = \Magento \Framework \App \Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS ;
444445 $ this ->_ensureDirExists ($ this ->installDir );
@@ -453,8 +454,9 @@ public function install()
453454 $ installParams = $ this ->getInstallCliParams ();
454455
455456 // performance optimization: restore DB from last good dump to make installation on top of it (much faster)
457+ // do not restore from the database if the cleanup option is set to ensure we have a clean DB to test on
456458 $ db = $ this ->getDbInstance ();
457- if ($ db ->isDbDumpExists ()) {
459+ if ($ db ->isDbDumpExists () && ! $ cleanup ) {
458460 $ db ->restoreFromDbDump ();
459461 }
460462
Original file line number Diff line number Diff line change 7474 $ application ->cleanup ();
7575 }
7676 if (!$ application ->isInstalled ()) {
77- $ application ->install ();
77+ $ application ->install ($ settings -> getAsBoolean ( ' TESTS_CLEANUP ' ) );
7878 }
7979 $ application ->initialize ([]);
8080
You can’t perform that action at this time.
0 commit comments