Skip to content

Commit

Permalink
Merge 9f6f1af into c6f580d
Browse files Browse the repository at this point in the history
  • Loading branch information
dschoenbauer committed Sep 12, 2017
2 parents c6f580d + 9f6f1af commit 6f4c15d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Config/Config.php
Expand Up @@ -74,6 +74,6 @@ public function setArrayDot(ArrayDotNotation $arrayDot)

public function filterPath($path)
{
return str_replace('/', DIRECTORY_SEPARATOR, trim($path, '/\\') . DIRECTORY_SEPARATOR);
return str_replace(['/','\\'], DIRECTORY_SEPARATOR, trim($path, '\\/') . DIRECTORY_SEPARATOR);
}
}
11 changes: 6 additions & 5 deletions tests/Config/ConfigTest.php
Expand Up @@ -41,6 +41,7 @@ public function testArrayDotNotation()
*/
public function testFitlerPath($path, $result)
{
chdir(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . self::PATH);
$this->assertEquals($result, $this->object->filterPath($path));
}

Expand All @@ -50,7 +51,7 @@ public function filterPathDataProvider()
'trailing-win' => ['test\\', 'test' . DIRECTORY_SEPARATOR],
'trailing-lin' => ['test/', 'test' . DIRECTORY_SEPARATOR],
'trailing-none' => ['test', 'test' . DIRECTORY_SEPARATOR],
'mid-win' => ['test\\one', 'test' . DIRECTORY_SEPARATOR . 'one' . DIRECTORY_SEPARATOR],
'mid-win' => ["test\one", 'test' . DIRECTORY_SEPARATOR . 'one' . DIRECTORY_SEPARATOR],
'mid-lin' => ['test/one', 'test' . DIRECTORY_SEPARATOR . 'one' . DIRECTORY_SEPARATOR],
];
}
Expand Down Expand Up @@ -120,10 +121,10 @@ public function testImportData($files, $result)
public function importDataDataProvider()
{
return [
'single file' => [['TestA\local.json'], ['local' => true]],
'multiple file' => [['TestB\local.json', 'TestB\remote.json',], ['local' => true, 'remote' => true]],
'competing files' => [['TestC\a\local.json', 'TestC\b\local.json',], ['local' => false]], //First file is true, second is false and wins with the value
'complicated data schema' => [['TestD\local.json', 'TestD\remote.json',],
'single file' => [['TestA' . DIRECTORY_SEPARATOR . 'local.json'], ['local' => true]],
'multiple file' => [['TestB' . DIRECTORY_SEPARATOR . 'local.json', 'TestB' . DIRECTORY_SEPARATOR . 'remote.json',], ['local' => true, 'remote' => true]],
'competing files' => [['TestC' . DIRECTORY_SEPARATOR . 'a' . DIRECTORY_SEPARATOR . 'local.json', 'TestC' . DIRECTORY_SEPARATOR . 'b' . DIRECTORY_SEPARATOR . 'local.json',], ['local' => false]], //First file is true, second is false and wins with the value
'complicated data schema' => [['TestD' . DIRECTORY_SEPARATOR . 'local.json', 'TestD' . DIRECTORY_SEPARATOR . 'remote.json',],
[
'local' => true,
'database' => [
Expand Down

0 comments on commit 6f4c15d

Please sign in to comment.