-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1410 from magento-frontend/PR_09_08
Fixed issues: - MAGETWO-70571 There is no possibility to activate DEBUG logging in production mode - MAGETWO-70806 The Recently Viewed widget UI issue
- Loading branch information
Showing
9 changed files
with
427 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Deploy\App\Mode; | ||
|
||
/** | ||
* This class is responsible for providing configuration while switching application mode | ||
*/ | ||
class ConfigProvider | ||
{ | ||
/** | ||
* Configuration for combinations of $currentMode and $targetMode | ||
* For example: | ||
* [ | ||
* 'developer' => [ | ||
* 'production' => [ | ||
* {{setting_path}} => {{setting_value}} | ||
* ] | ||
* ] | ||
* ] | ||
* | ||
* @var array | ||
*/ | ||
private $config; | ||
|
||
/** | ||
* @param array $config | ||
*/ | ||
public function __construct(array $config = []) | ||
{ | ||
$this->config = $config; | ||
} | ||
|
||
/** | ||
* Provide configuration while switching from $currentMode to $targetMode | ||
* This method used in \Magento\Deploy\Model\Mode::setStoreMode | ||
* | ||
* For example: while switching from developer mode to production mode | ||
* need to turn off 'dev/debug/debug_logging' setting in this case method | ||
* will return array | ||
* [ | ||
* {{setting_path}} => {{setting_value}} | ||
* ] | ||
* | ||
* @param string $currentMode | ||
* @param string $targetMode | ||
* @return array | ||
*/ | ||
public function getConfigs($currentMode, $targetMode) | ||
{ | ||
if (isset($this->config[$currentMode][$targetMode])) { | ||
return $this->config[$currentMode][$targetMode]; | ||
} | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
app/code/Magento/Deploy/Test/Unit/App/Mode/ConfigProviderTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Deploy\Test\Unit\App\Mode; | ||
|
||
use Magento\Deploy\App\Mode\ConfigProvider; | ||
|
||
class ConfigProviderTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testGetConfigs() | ||
{ | ||
$expectedValue = [ | ||
'{{setting_path}}' => '{{setting_value}}' | ||
]; | ||
$configProvider = new ConfigProvider( | ||
[ | ||
'developer' => [ | ||
'production' => $expectedValue | ||
] | ||
] | ||
); | ||
$this->assertEquals($expectedValue, $configProvider->getConfigs('developer', 'production')); | ||
$this->assertEquals([], $configProvider->getConfigs('undefined', 'production')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.