Skip to content

Commit 1abe394

Browse files
minor #550 Adds tests for Path helper. (dbrumann)
This PR was merged into the 1.8-dev branch. Discussion ---------- Adds tests for Path helper. I wanted to make sure I understand how concatenate on Path works for my PR for #513 and maybe the tests are valuable to others as well. Commits ------- 7081853 Adds tests for Path helper.
2 parents 83cd9bd + 7081853 commit 1abe394

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/PathTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,27 @@ public function testConcatenateOnWindows()
2222

2323
$this->assertEquals('c:\\my-project/src/kernel.php', $path->concatenate(['c:\\my-project', 'src/', 'kernel.php']));
2424
}
25+
26+
/**
27+
* @dataProvider providePathsForConcatenation
28+
*/
29+
public function testConcatenate($part1, $part2, $expectedPath)
30+
{
31+
$path = new Path('');
32+
33+
$actualPath = $path->concatenate([$part1, $part2]);
34+
35+
$this->assertEquals($expectedPath, $actualPath);
36+
}
37+
38+
public function providePathsForConcatenation()
39+
{
40+
return [
41+
[__DIR__, 'foo/bar.txt', __DIR__.'/foo/bar.txt'],
42+
[__DIR__, '/foo/bar.txt', __DIR__.'/foo/bar.txt'],
43+
['', 'foo/bar.txt', '/foo/bar.txt'],
44+
['', '/foo/bar.txt', '/foo/bar.txt'],
45+
['.', 'foo/bar.txt', './foo/bar.txt'],
46+
];
47+
}
2548
}

0 commit comments

Comments
 (0)