|
3 | 3 | namespace PHPStan\Compiler\Filesystem;
|
4 | 4 |
|
5 | 5 | use PHPUnit\Framework\TestCase;
|
| 6 | +use Symfony\Component\Filesystem\Filesystem; |
| 7 | +use function unlink; |
6 | 8 |
|
7 | 9 | final class SymfonyFilesystemTest extends TestCase
|
8 | 10 | {
|
9 | 11 |
|
10 | 12 | public function testExists(): void
|
11 | 13 | {
|
12 |
| - $inner = $this->createMock(\Symfony\Component\Filesystem\Filesystem::class); |
| 14 | + $inner = $this->createMock(Filesystem::class); |
13 | 15 | $inner->expects(self::once())->method('exists')->with('foo')->willReturn(true);
|
14 | 16 |
|
15 | 17 | self::assertTrue((new SymfonyFilesystem($inner))->exists('foo'));
|
16 | 18 | }
|
17 | 19 |
|
18 | 20 | public function testRemove(): void
|
19 | 21 | {
|
20 |
| - $inner = $this->createMock(\Symfony\Component\Filesystem\Filesystem::class); |
| 22 | + $inner = $this->createMock(Filesystem::class); |
21 | 23 | $inner->expects(self::once())->method('remove')->with('foo')->willReturn(true);
|
22 | 24 |
|
23 | 25 | (new SymfonyFilesystem($inner))->remove('foo');
|
24 | 26 | }
|
25 | 27 |
|
26 | 28 | public function testMkdir(): void
|
27 | 29 | {
|
28 |
| - $inner = $this->createMock(\Symfony\Component\Filesystem\Filesystem::class); |
| 30 | + $inner = $this->createMock(Filesystem::class); |
29 | 31 | $inner->expects(self::once())->method('mkdir')->with('foo')->willReturn(true);
|
30 | 32 |
|
31 | 33 | (new SymfonyFilesystem($inner))->mkdir('foo');
|
32 | 34 | }
|
33 | 35 |
|
34 | 36 | public function testRead(): void
|
35 | 37 | {
|
36 |
| - $inner = $this->createMock(\Symfony\Component\Filesystem\Filesystem::class); |
| 38 | + $inner = $this->createMock(Filesystem::class); |
37 | 39 |
|
38 | 40 | $content = (new SymfonyFilesystem($inner))->read(__DIR__ . '/data/composer.json');
|
39 | 41 | self::assertSame("{}\n", $content);
|
40 | 42 | }
|
41 | 43 |
|
42 | 44 | public function testWrite(): void
|
43 | 45 | {
|
44 |
| - $inner = $this->createMock(\Symfony\Component\Filesystem\Filesystem::class); |
| 46 | + $inner = $this->createMock(Filesystem::class); |
45 | 47 |
|
46 | 48 | @unlink(__DIR__ . '/data/test.json');
|
47 | 49 | (new SymfonyFilesystem($inner))->write(__DIR__ . '/data/test.json', "{}\n");
|
|
0 commit comments