-
-
Notifications
You must be signed in to change notification settings - Fork 439
Expand file tree
/
Copy pathFilePathHelperTest.php
More file actions
38 lines (31 loc) · 980 Bytes
/
FilePathHelperTest.php
File metadata and controls
38 lines (31 loc) · 980 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
declare(strict_types=1);
namespace Rector\Tests\FileSystem;
use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Rector\FileSystem\FilePathHelper;
use Symfony\Component\Filesystem\Filesystem;
final class FilePathHelperTest extends TestCase
{
private FilePathHelper $filePathHelper;
protected function setUp(): void
{
$this->filePathHelper = new FilePathHelper(new Filesystem());
}
#[DataProvider('provideData')]
public function test(string $inputPath, string $expectedNormalizedPath): void
{
$normalizedPath = $this->filePathHelper->normalizePathAndSchema($inputPath);
$this->assertSame($expectedNormalizedPath, $normalizedPath);
}
/**
* @return Iterator<array<int, string>>
*/
public static function provideData(): Iterator
{
// based on Linux
yield ['/any/path', '/any/path'];
yield ['\any\path', '/any/path'];
}
}