@@ 105-118 (lines=14) @@ | ||
102 | $this->transfer->moveTo($fromFile, $toFile); |
|
103 | } |
|
104 | ||
105 | public function testCopyWhenFilesystemDoesNotReadStreamThrowsAnException() |
|
106 | { |
|
107 | $filesystem = m::mock('League\Flysystem\FileSystemInterface')->makePartial(); |
|
108 | ||
109 | $fromFile = new FileNode($filesystem, 'some/file'); |
|
110 | ||
111 | $toFile = new LocalFile(static::$dir . 'fail_copy_file.text'); |
|
112 | ||
113 | $filesystem->shouldReceive('readStream')->with($fromFile->getPath())->andReturn(false); |
|
114 | ||
115 | $this->expectException(TransferFailedException::class); |
|
116 | ||
117 | $this->transfer->copyTo($fromFile, $toFile); |
|
118 | } |
|
119 | ||
120 | public function testMoveWhenFilesystemDoesNotReadStreamThrowsAnException() |
|
121 | { |
|
@@ 120-133 (lines=14) @@ | ||
117 | $this->transfer->copyTo($fromFile, $toFile); |
|
118 | } |
|
119 | ||
120 | public function testMoveWhenFilesystemDoesNotReadStreamThrowsAnException() |
|
121 | { |
|
122 | $filesystem = m::mock('League\Flysystem\FileSystemInterface')->makePartial(); |
|
123 | ||
124 | $fromFile = new FileNode($filesystem, 'some/file'); |
|
125 | ||
126 | $toFile = new LocalFile(static::$dir . 'fail_move_file.text'); |
|
127 | ||
128 | $filesystem->shouldReceive('readStream')->with($fromFile->getPath())->andReturn(false); |
|
129 | ||
130 | $this->expectException(TransferFailedException::class); |
|
131 | ||
132 | $this->transfer->moveTo($fromFile, $toFile); |
|
133 | } |
|
134 | } |
|
135 |
@@ 25-37 (lines=13) @@ | ||
22 | ||
23 | class MakeDirectoryTest extends TestCase |
|
24 | { |
|
25 | public function testWhenCreateDirReturnsFalseAnExceptionIsthrown() |
|
26 | { |
|
27 | $fileSystem = m::mock(FilesystemInterface::class); |
|
28 | $directory = new FileNode($fileSystem, 'random/path'); |
|
29 | ||
30 | $fileSystem->shouldReceive('createDir') |
|
31 | ->with($directory->getDirectory(), ['visibility' => 'public']) |
|
32 | ->andReturn(false); |
|
33 | $this->expectException(MakedirectoryFailedException::class); |
|
34 | ||
35 | $maker = new MakeDirectory(); |
|
36 | $maker->makeDirectory($directory); |
|
37 | } |
|
38 | } |
|
39 |