Skip to content
Snippets Groups Projects
Commit 98d8a3e8 authored by Bohdan Korablov's avatar Bohdan Korablov
Browse files

MAGETWO-62491: [PR] Delivery of stories (sprint 3)

parent 7360787e
Branches
No related merge requests found
......@@ -59,7 +59,7 @@ class Environment implements PlaceholderInterface
*/
public function restore($template)
{
$template = str_replace(static::PREFIX, '', $template);
$template = preg_replace('/^' . static::PREFIX . '/', '', $template);
$template = str_replace('__', '/', $template);
$template = strtolower($template);
......
......@@ -47,8 +47,8 @@ class EnvironmentTest extends \PHPUnit_Framework_TestCase
public function testGenerate($path, $scope, $scopeId, $expected)
{
$this->assertSame(
$this->model->generate($path, $scope, $scopeId),
$expected
$expected,
$this->model->generate($path, $scope, $scopeId)
);
}
......@@ -103,4 +103,29 @@ class EnvironmentTest extends \PHPUnit_Framework_TestCase
[Environment::PREFIX . 'A@#$', false]
];
}
/**
* @param string $template
* @param string $expected
* @dataProvider restoreDataProvider
*/
public function testRestore($template, $expected)
{
$this->assertSame(
$expected,
$this->model->restore($template)
);
}
/**
* @return array
*/
public function restoreDataProvider()
{
return [
[Environment::PREFIX . 'TEST__CONFIG', 'test/config'],
[Environment::PREFIX . 'TEST__CONFIG__VALUE', 'test/config/value'],
[Environment::PREFIX . 'TEST__CONFIG_VALUE', 'test/config_value'],
];
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment