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