Code Duplication    Length = 13-14 lines in 3 locations

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

@@ 94-107 (lines=14) @@
91
        $this->transfer->moveTo($fromFile, $toFile);
92
    }
93
94
    public function testCopyWhenFilesystemDoesNotReadStreamThrowsAnException()
95
    {
96
        $filesystem = m::mock('League\Flysystem\FileSystemInterface')->makePartial();
97
98
        $fromFile = new FileNode($filesystem, 'some/file');
99
100
        $toFile = new LocalFile(static::$dir . 'fail_copy_file.text');
101
102
        $filesystem->shouldReceive('readStream')->with($fromFile->getPath())->andReturn(false);
103
104
        $this->expectException(TransferFailedException::class);
105
106
        $this->transfer->copyTo($fromFile, $toFile);
107
    }
108
109
    public function testMoveWhenFilesystemDoesNotReadStreamThrowsAnException()
110
    {
@@ 109-122 (lines=14) @@
106
        $this->transfer->copyTo($fromFile, $toFile);
107
    }
108
109
    public function testMoveWhenFilesystemDoesNotReadStreamThrowsAnException()
110
    {
111
        $filesystem = m::mock('League\Flysystem\FileSystemInterface')->makePartial();
112
113
        $fromFile = new FileNode($filesystem, 'some/file');
114
115
        $toFile = new LocalFile(static::$dir . 'fail_move_file.text');
116
117
        $filesystem->shouldReceive('readStream')->with($fromFile->getPath())->andReturn(false);
118
119
        $this->expectException(TransferFailedException::class);
120
121
        $this->transfer->moveTo($fromFile, $toFile);
122
    }
123
}
124

tests/unit/Modify/MakeDirectoryTest.php 1 location

@@ 14-26 (lines=13) @@
11
12
class MakeDirectoryTest extends TestCase
13
{
14
    public function testWhenCreateDirReturnsFalseAnExceptionIsthrown()
15
    {
16
        $fileSystem = m::mock(FilesystemInterface::class);
17
        $directory = new FileNode($fileSystem, 'random/path');
18
19
        $fileSystem->shouldReceive('createDir')
20
                   ->with($directory->getDirectory(), ['visibility' => 'public'])
21
                   ->andReturn(false);
22
        $this->expectException(MakedirectoryFailedException::class);
23
24
        $maker = new MakeDirectory();
25
        $maker->makeDirectory($directory);
26
    }
27
}
28