Skip to content

Commit 09cc206

Browse files
MAGETWO-86337: #4292: Ability to sitch to default mode #12752
2 parents 79d8e9a + d14357b commit 09cc206

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

app/code/Magento/Deploy/Console/Command/SetModeCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
101101
$modeController->enableProductionMode();
102102
}
103103
break;
104+
case State::MODE_DEFAULT:
105+
$modeController->enableDefaultMode();
106+
break;
104107
default:
105108
throw new LocalizedException(__('Cannot switch into given mode "%1"', $toMode));
106109
}

app/code/Magento/Deploy/Model/Mode.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,25 @@ public function enableDeveloperMode()
177177
$this->setStoreMode(State::MODE_DEVELOPER);
178178
}
179179

180+
/**
181+
* Enable Default mode
182+
*
183+
* @return void
184+
*/
185+
public function enableDefaultMode()
186+
{
187+
$this->filesystem->cleanupFilesystem(
188+
[
189+
DirectoryList::CACHE,
190+
DirectoryList::GENERATED_CODE,
191+
DirectoryList::GENERATED_METADATA,
192+
DirectoryList::TMP_MATERIALIZATION_DIR,
193+
DirectoryList::STATIC_VIEW,
194+
]
195+
);
196+
$this->setStoreMode(State::MODE_DEFAULT);
197+
}
198+
180199
/**
181200
* Get current mode information
182201
*

app/code/Magento/Deploy/Test/Unit/Console/Command/SetModeCommandTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ public function testSetDeveloperMode()
6767
);
6868
}
6969

70+
public function testSetDefaultMode()
71+
{
72+
$this->modeMock->expects($this->once())->method('enableDefaultMode');
73+
74+
$tester = new CommandTester($this->command);
75+
$tester->execute(['mode' => 'default']);
76+
$this->assertContains(
77+
"default mode",
78+
$tester->getDisplay()
79+
);
80+
}
81+
7082
public function testSetProductionSkipCompilation()
7183
{
7284
$this->modeMock->expects($this->once())->method('enableProductionModeMinimal');

0 commit comments

Comments
 (0)