From e32e4ad490b6326e5b71f6982c0dd6879f4be129 Mon Sep 17 00:00:00 2001 From: Karoly Negyesi Date: Sun, 22 Sep 2013 19:42:05 +0200 Subject: [PATCH] change the test to test for a target dir change --- .../Test/Installer/LibraryInstallerTest.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/Composer/Test/Installer/LibraryInstallerTest.php b/tests/Composer/Test/Installer/LibraryInstallerTest.php index f87a8c9c9..fcebc8328 100644 --- a/tests/Composer/Test/Installer/LibraryInstallerTest.php +++ b/tests/Composer/Test/Installer/LibraryInstallerTest.php @@ -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');