diff --git a/src/ACFProInstaller/RemoteFilesystem.php b/src/ACFProInstaller/RemoteFilesystem.php index cdd36a6..d934b02 100644 --- a/src/ACFProInstaller/RemoteFilesystem.php +++ b/src/ACFProInstaller/RemoteFilesystem.php @@ -59,7 +59,7 @@ public function copy( $progress = true, $options = [] ) { - parent::copy( + return parent::copy( $originUrl, $this->acfFileUrl, $fileName, diff --git a/tests/ACFProInstaller/RemoteFilesystemTest.php b/tests/ACFProInstaller/RemoteFilesystemTest.php index d4d1529..7a7426c 100644 --- a/tests/ACFProInstaller/RemoteFilesystemTest.php +++ b/tests/ACFProInstaller/RemoteFilesystemTest.php @@ -9,29 +9,28 @@ class RemoteFilesystemTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $this->config = $this->getMockBuilder('Composer\Config')->getMock(); + $this->io = $this->getMock('Composer\IO\IOInterface'); } public function testExtendsComposerRemoteFilesystem() { $this->assertInstanceOf( 'Composer\Util\RemoteFilesystem', - new RemoteFilesystem('', $this->io, $this->config) + new RemoteFilesystem('', $this->io) ); } + // Inspired by testCopy of Composer public function testCopyUsesAcfFileUrl() { - $acfFileUrl = 'acfFileUrl'; + $acfFileUrl = 'file://'.__FILE__; + $rfs = new RemoteFilesystem($acfFileUrl, $this->io); + $file = tempnam(sys_get_temp_dir(), 'pb'); - // Expect an Exception - $this->setExpectedException( - 'Composer\Downloader\TransportException', - $acfFileUrl + $this->assertTrue( + $rfs->copy('http://example.org', 'does-not-exist', $file) ); - - $rfs = new RemoteFilesystem($acfFileUrl, $this->io, $this->config); - $rfs->copy('orginUrl', 'fileUrl', 'fileName'); + $this->assertFileExists($file); + unlink($file); } }