Code Duplication    Length = 13-15 lines in 3 locations

tests/unit/Modify/MakeDirectoryTest.php 1 location

@@ 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

tests/integration/Modify/Transfer/TransferTest.php 2 locations

@@ 106-120 (lines=15) @@
103
        $this->transfer->moveTo($fromFile, $toFile);
104
    }
105
106
    public function testCopyWhenFilesystemDoesNotReadStreamThrowsAnException()
107
    {
108
        $filesystem = m::mock(FilesystemInterface::class)->makePartial();
109
110
        $fromFile = new FileNode($filesystem, 'some/file');
111
112
        $toFile = new LocalFile(static::$dir . 'fail_copy_file.text');
113
114
        $filesystem->shouldReceive('readStream')->with($fromFile->getPath())->andReturn(false);
115
116
        $this->expectException(TransferFailedException::class);
117
118
        $this->transfer->copyTo($fromFile, $toFile);
119
    }
120
121
    public function testMoveWhenFilesystemDoesNotReadStreamThrowsAnException()
122
    {
123
        $filesystem = m::mock(FilesystemInterface::class)->makePartial();
@@ 121-135 (lines=15) @@
118
        $this->transfer->copyTo($fromFile, $toFile);
119
    }
120
121
    public function testMoveWhenFilesystemDoesNotReadStreamThrowsAnException()
122
    {
123
        $filesystem = m::mock(FilesystemInterface::class)->makePartial();
124
125
        $fromFile = new FileNode($filesystem, 'some/file');
126
127
        $toFile = new LocalFile(static::$dir . 'fail_move_file.text');
128
129
        $filesystem->shouldReceive('readStream')->with($fromFile->getPath())->andReturn(false);
130
131
        $this->expectException(TransferFailedException::class);
132
133
        $this->transfer->moveTo($fromFile, $toFile);
134
    }
135
}
136