|
@@ -131,8 +131,13 @@ class LibraryInstallerTest extends TestCase
|
|
|
*/
|
|
|
public function testUpdate()
|
|
|
{
|
|
|
- $filesystem = $this->getMockBuilder('Composer\Util\Filesystem')->getMock();
|
|
|
- $library = new LibraryInstaller($this->io, $this->composer, 'library', $filesystem);
|
|
|
+ $filesystem = $this->getMockBuilder('Composer\Util\Filesystem')
|
|
|
+ ->getMock();
|
|
|
+ $filesystem
|
|
|
+ ->expects($this->once())
|
|
|
+ ->method('copyThenRemove')
|
|
|
+ ->with($this->vendorDir.'/package1', $this->vendorDir.'/package1/newtarget');
|
|
|
+
|
|
|
$initial = $this->createPackageMock();
|
|
|
$target = $this->createPackageMock();
|
|
|
|
|
@@ -146,6 +151,11 @@ class LibraryInstallerTest extends TestCase
|
|
|
->method('getPrettyName')
|
|
|
->will($this->returnValue('package1'));
|
|
|
|
|
|
+ $target
|
|
|
+ ->expects($this->once())
|
|
|
+ ->method('getTargetDir')
|
|
|
+ ->will($this->returnValue('newtarget'));
|
|
|
+
|
|
|
$this->repository
|
|
|
->expects($this->exactly(3))
|
|
|
->method('hasPackage')
|
|
@@ -154,7 +164,7 @@ class LibraryInstallerTest extends TestCase
|
|
|
$this->dm
|
|
|
->expects($this->once())
|
|
|
->method('update')
|
|
|
- ->with($initial, $target, $this->vendorDir.'/package1');
|
|
|
+ ->with($initial, $target, $this->vendorDir.'/package1/newtarget');
|
|
|
|
|
|
$this->repository
|
|
|
->expects($this->once())
|
|
@@ -166,6 +176,7 @@ class LibraryInstallerTest extends TestCase
|
|
|
->method('addPackage')
|
|
|
->with($target);
|
|
|
|
|
|
+ $library = new LibraryInstaller($this->io, $this->composer, 'library', $filesystem);
|
|
|
$library->update($this->repository, $initial, $target);
|
|
|
$this->assertFileExists($this->vendorDir, 'Vendor dir should be created');
|
|
|
$this->assertFileExists($this->binDir, 'Bin dir should be created');
|