@@ 27-37 (lines=11) @@ | ||
24 | ); |
|
25 | } |
|
26 | ||
27 | public function testGetRelativePathWithWindowsPath(): void |
|
28 | { |
|
29 | $configurationMock = $this->createMock(ConfigurationInterface::class); |
|
30 | $configurationMock->method('getOption') |
|
31 | ->willReturn(['C:\some\dir']); |
|
32 | ||
33 | $relativePathResolver = new RelativePathResolver($configurationMock, new FileSystem); |
|
34 | ||
35 | $this->assertSame('file.txt', $relativePathResolver->getRelativePath('C:\some\dir\file.txt')); |
|
36 | $this->assertSame('more-dir/file.txt', $relativePathResolver->getRelativePath('C:\some\dir\more-dir\file.txt')); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * @expectedException \InvalidArgumentException |
|
@@ 56-67 (lines=12) @@ | ||
53 | /** |
|
54 | * Issue #408 |
|
55 | */ |
|
56 | public function testGetRelativePathWithSourceEndingSlash(): void |
|
57 | { |
|
58 | $configurationMock = $this->createMock(ConfigurationInterface::class); |
|
59 | $configurationMock->method('getOption') |
|
60 | ->with('source') |
|
61 | ->willReturn(['ProjectBeta']); |
|
62 | ||
63 | $relativePathResolver = new RelativePathResolver($configurationMock, new FileSystem); |
|
64 | ||
65 | $fileName = 'ProjectBeta/entities/Category.php'; |
|
66 | $this->assertSame('entities/Category.php', $relativePathResolver->getRelativePath($fileName)); |
|
67 | } |
|
68 | } |
|
69 |