Skip to content

Commit ac4b29a

Browse files
Merge branch 'MAGETWO-62736' of https://github.com/magento-falcons/magento2ce into MAGETWO-65085
# Conflicts: # dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php
2 parents 13f39a4 + 481ed85 commit ac4b29a

File tree

26 files changed

+643
-345
lines changed

26 files changed

+643
-345
lines changed

app/code/Magento/Config/Console/Command/ConfigSet/LockProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function process($path, $value, $scope, $scopeCode)
122122
$backendModel->beforeSave();
123123

124124
$this->deploymentConfigWriter->saveConfig(
125-
[ConfigFilePool::APP_CONFIG => $this->arrayManager->set($configPath, [], $backendModel->getValue())],
125+
[ConfigFilePool::APP_ENV => $this->arrayManager->set($configPath, [], $backendModel->getValue())],
126126
false
127127
);
128128

app/code/Magento/Config/Test/Unit/Console/Command/ConfigSet/LockProcessorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public function testProcess($path, $value, $scope, $scopeCode)
164164
->method('saveConfig')
165165
->with(
166166
[
167-
ConfigFilePool::APP_CONFIG => [
167+
ConfigFilePool::APP_ENV => [
168168
'system' => [
169169
'default' => [
170170
'test' => [
@@ -234,7 +234,7 @@ public function testProcessBackendModelNotExists()
234234
->method('saveConfig')
235235
->with(
236236
[
237-
ConfigFilePool::APP_CONFIG => [
237+
ConfigFilePool::APP_ENV => [
238238
'system' => [
239239
'default' => [
240240
'test' => [

app/code/Magento/Config/etc/di.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@
145145
<arguments>
146146
<argument name="reader" xsi:type="object">Magento\Framework\App\DeploymentConfig\Reader</argument>
147147
<argument name="configType" xsi:type="const">Magento\Config\App\Config\Type\System::CONFIG_TYPE</argument>
148-
<argument name="fileKey" xsi:type="const">Magento\Framework\Config\File\ConfigFilePool::APP_CONFIG</argument>
149148
</arguments>
150149
</virtualType>
151150
<virtualType name="appDumpSystemSource" type="Magento\Config\App\Config\Source\DumpConfigSourceAggregated">
@@ -201,7 +200,7 @@
201200
<item name="source" xsi:type="object">systemConfigInitialDataProvider</item>
202201
<item name="sortOrder" xsi:type="string">1000</item>
203202
</item>
204-
<item name="env" xsi:type="array">
203+
<item name="envVariable" xsi:type="array">
205204
<item name="source" xsi:type="object">Magento\Config\App\Config\Source\EnvironmentConfigSource</item>
206205
<item name="sortOrder" xsi:type="string">2000</item>
207206
</item>

app/code/Magento/Deploy/Console/Command/App/ApplicationDumpCommand.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
8686
: $sourceData['comment']->get();
8787
}
8888
}
89-
$this->writer
90-
->saveConfig(
91-
[ConfigFilePool::APP_CONFIG => $dump],
92-
true,
93-
ConfigFilePool::LOCAL,
94-
$comments
95-
);
89+
$this->writer->saveConfig(
90+
[ConfigFilePool::APP_CONFIG => $dump],
91+
true,
92+
null,
93+
$comments
94+
);
9695
if (!empty($comments)) {
9796
$output->writeln($comments);
9897
}

app/code/Magento/Deploy/Console/Command/App/SensitiveConfigSetCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ private function writeSuccessMessage(OutputInterface $output, $isInteractive)
163163
$output->writeln(sprintf(
164164
'<info>Configuration value%s saved in app/etc/%s</info>',
165165
$isInteractive ? 's' : '',
166-
$this->configFilePool->getPath(ConfigFilePool::APP_CONFIG)
166+
$this->configFilePool->getPath(ConfigFilePool::APP_ENV)
167167
));
168168
}
169169

@@ -175,7 +175,7 @@ private function writeSuccessMessage(OutputInterface $output, $isInteractive)
175175
*/
176176
private function getConfigPaths()
177177
{
178-
$configFilePath = $this->configFilePool->getPathsByPool(ConfigFilePool::LOCAL)[ConfigFilePool::APP_CONFIG];
178+
$configFilePath = $this->configFilePool->getPath(ConfigFilePool::APP_CONFIG);
179179
try {
180180
$configPaths = $this->commentParser->execute($configFilePath);
181181
} catch (FileSystemException $e) {

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@ public function save(array $values, $scope = ScopeConfigInterface::SCOPE_TYPE_DE
5555
$config = $this->setConfig($config, $fullConfigPath, $configValue);
5656
}
5757

58-
$this->writer
59-
->saveConfig(
60-
[ConfigFilePool::APP_CONFIG => $config]
61-
);
58+
$this->writer->saveConfig(
59+
[ConfigFilePool::APP_ENV => $config]
60+
);
6261
}
6362

6463
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function enableDeveloperMode()
122122
*/
123123
public function getMode()
124124
{
125-
$env = $this->reader->load(ConfigFilePool::APP_ENV);
125+
$env = $this->reader->load();
126126
return isset($env[State::PARAM_MODE]) ? $env[State::PARAM_MODE] : null;
127127
}
128128

app/code/Magento/Deploy/Test/Unit/Console/Command/App/SensitiveConfigSetCommandTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,9 @@ public function setUp()
8686
public function testConfigFileNotExist()
8787
{
8888
$this->configFilePoolMock->expects($this->once())
89-
->method('getPathsByPool')
90-
->with(ConfigFilePool::LOCAL)
91-
->willReturn([
92-
ConfigFilePool::APP_CONFIG => 'config.local.php'
93-
]);
89+
->method('getPath')
90+
->with(ConfigFilePool::APP_CONFIG)
91+
->willReturn('config.php');
9492
$this->scopeValidatorMock->expects($this->once())
9593
->method('isValid')
9694
->with('default', '')
@@ -110,7 +108,7 @@ public function testConfigFileNotExist()
110108
$tester->getStatusCode()
111109
);
112110
$this->assertContains(
113-
'File app/etc/config.local.php can\'t be read. '
111+
'File app/etc/config.php can\'t be read. '
114112
. 'Please check if it exists and has read permissions.',
115113
$tester->getDisplay()
116114
);

app/code/Magento/Deploy/Test/Unit/Model/ConfigWriterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testSave()
6565
->willReturn($config);
6666
$this->writerMock->expects($this->once())
6767
->method('saveConfig')
68-
->with([ConfigFilePool::APP_CONFIG => $config]);
68+
->with([ConfigFilePool::APP_ENV => $config]);
6969

7070
$this->model->save($values, 'scope', 'scope_code');
7171
}
@@ -89,7 +89,7 @@ public function testSaveDefaultScope()
8989
->willReturn($config);
9090
$this->writerMock->expects($this->once())
9191
->method('saveConfig')
92-
->with([ConfigFilePool::APP_CONFIG => $config]);
92+
->with([ConfigFilePool::APP_ENV => $config]);
9393

9494
$this->model->save($values);
9595
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Deploy\Test\Unit\Model;
7+
8+
use Magento\Deploy\Model\Filesystem;
9+
use Magento\Deploy\Model\Mode;
10+
use Magento\Framework\App\DeploymentConfig\Reader;
11+
use Magento\Framework\App\DeploymentConfig\Writer;
12+
use Magento\Framework\App\MaintenanceMode;
13+
use Magento\Framework\App\State;
14+
use PHPUnit_Framework_MockObject_MockObject as Mock;
15+
use Symfony\Component\Console\Input\InputInterface;
16+
use Symfony\Component\Console\Output\OutputInterface;
17+
18+
/**
19+
* @inheritdoc
20+
*/
21+
class ModeTest extends \PHPUnit_Framework_TestCase
22+
{
23+
/**
24+
* @var Mode
25+
*/
26+
private $model;
27+
28+
/**
29+
* @var Reader|Mock
30+
*/
31+
private $readerMock;
32+
33+
/**
34+
* @var InputInterface|Mock
35+
*/
36+
private $inputMock;
37+
38+
/**
39+
* @var OutputInterface|Mock
40+
*/
41+
private $outputMock;
42+
43+
/**
44+
* @var Writer|Mock
45+
*/
46+
private $writerMock;
47+
48+
/**
49+
* @var MaintenanceMode|Mock
50+
*/
51+
private $maintenanceMock;
52+
53+
/**
54+
* @var Filesystem|Mock
55+
*/
56+
private $filesystemMock;
57+
58+
protected function setUp()
59+
{
60+
$this->inputMock = $this->getMockBuilder(InputInterface::class)
61+
->getMockForAbstractClass();
62+
$this->outputMock = $this->getMockBuilder(OutputInterface::class)
63+
->getMockForAbstractClass();
64+
$this->writerMock = $this->getMockBuilder(Writer::class)
65+
->disableOriginalConstructor()
66+
->getMock();
67+
$this->readerMock = $this->getMockBuilder(Reader::class)
68+
->disableOriginalConstructor()
69+
->getMock();
70+
$this->maintenanceMock = $this->getMockBuilder(MaintenanceMode::class)
71+
->disableOriginalConstructor()
72+
->getMock();
73+
$this->filesystemMock = $this->getMockBuilder(Filesystem::class)
74+
->disableOriginalConstructor()
75+
->getMock();
76+
77+
$this->model = new Mode(
78+
$this->inputMock,
79+
$this->outputMock,
80+
$this->writerMock,
81+
$this->readerMock,
82+
$this->maintenanceMock,
83+
$this->filesystemMock
84+
);
85+
}
86+
87+
public function testGetMode()
88+
{
89+
$this->readerMock->expects($this->exactly(2))
90+
->method('load')
91+
->willReturnOnConsecutiveCalls(
92+
[],
93+
[State::PARAM_MODE => State::MODE_DEVELOPER]
94+
);
95+
96+
$this->assertSame(null, $this->model->getMode());
97+
$this->assertSame(State::MODE_DEVELOPER, $this->model->getMode());
98+
}
99+
}

0 commit comments

Comments
 (0)