@@ -9,29 +9,28 @@ class RemoteFilesystemTest extends \PHPUnit_Framework_TestCase
9
9
10
10
protected function setUp ()
11
11
{
12
- $ this ->io = $ this ->getMockBuilder ('Composer\IO\IOInterface ' )->getMock ();
13
- $ this ->config = $ this ->getMockBuilder ('Composer\Config ' )->getMock ();
12
+ $ this ->io = $ this ->getMock ('Composer\IO\IOInterface ' );
14
13
}
15
14
16
15
public function testExtendsComposerRemoteFilesystem ()
17
16
{
18
17
$ this ->assertInstanceOf (
19
18
'Composer\Util\RemoteFilesystem ' ,
20
- new RemoteFilesystem ('' , $ this ->io , $ this -> config )
19
+ new RemoteFilesystem ('' , $ this ->io )
21
20
);
22
21
}
23
22
23
+ // Inspired by testCopy of Composer
24
24
public function testCopyUsesAcfFileUrl ()
25
25
{
26
- $ acfFileUrl = 'acfFileUrl ' ;
26
+ $ acfFileUrl = 'file:// ' .__FILE__ ;
27
+ $ rfs = new RemoteFilesystem ($ acfFileUrl , $ this ->io );
28
+ $ file = tempnam (sys_get_temp_dir (), 'pb ' );
27
29
28
- // Expect an Exception
29
- $ this ->setExpectedException (
30
- 'Composer\Downloader\TransportException ' ,
31
- $ acfFileUrl
30
+ $ this ->assertTrue (
31
+ $ rfs ->copy ('http://example.org ' , 'does-not-exist ' , $ file )
32
32
);
33
-
34
- $ rfs = new RemoteFilesystem ($ acfFileUrl , $ this ->io , $ this ->config );
35
- $ rfs ->copy ('orginUrl ' , 'fileUrl ' , 'fileName ' );
33
+ $ this ->assertFileExists ($ file );
34
+ unlink ($ file );
36
35
}
37
36
}
0 commit comments