Skip to content

Commit 98d8a3e

Browse files
author
Bohdan Korablov
committed
MAGETWO-62491: [PR] Delivery of stories (sprint 3)
1 parent 7360787 commit 98d8a3e

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

app/code/Magento/Config/Model/Placeholder/Environment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function generate($path, $scopeType = ScopeConfigInterface::SCOPE_TYPE_DE
5959
*/
6060
public function restore($template)
6161
{
62-
$template = str_replace(static::PREFIX, '', $template);
62+
$template = preg_replace('/^' . static::PREFIX . '/', '', $template);
6363
$template = str_replace('__', '/', $template);
6464
$template = strtolower($template);
6565

app/code/Magento/Config/Test/Unit/Model/Placeholder/EnvironmentTest.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ protected function setUp()
4747
public function testGenerate($path, $scope, $scopeId, $expected)
4848
{
4949
$this->assertSame(
50-
$this->model->generate($path, $scope, $scopeId),
51-
$expected
50+
$expected,
51+
$this->model->generate($path, $scope, $scopeId)
5252
);
5353
}
5454

@@ -103,4 +103,29 @@ public function getIsPlaceholderDataProvider()
103103
[Environment::PREFIX . 'A@#$', false]
104104
];
105105
}
106+
107+
/**
108+
* @param string $template
109+
* @param string $expected
110+
* @dataProvider restoreDataProvider
111+
*/
112+
public function testRestore($template, $expected)
113+
{
114+
$this->assertSame(
115+
$expected,
116+
$this->model->restore($template)
117+
);
118+
}
119+
120+
/**
121+
* @return array
122+
*/
123+
public function restoreDataProvider()
124+
{
125+
return [
126+
[Environment::PREFIX . 'TEST__CONFIG', 'test/config'],
127+
[Environment::PREFIX . 'TEST__CONFIG__VALUE', 'test/config/value'],
128+
[Environment::PREFIX . 'TEST__CONFIG_VALUE', 'test/config_value'],
129+
];
130+
}
106131
}

0 commit comments

Comments
 (0)