1
0
Fork 0

change the test to test for a target dir change

pull/2279/head
Karoly Negyesi 2013-09-22 19:42:05 +02:00
parent 1a69d0a2a7
commit e32e4ad490
1 changed files with 14 additions and 3 deletions

View File

@ -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');