1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Handle --dev installs/updates

This commit is contained in:
Jordi Boggiano 2012-04-14 15:45:25 +02:00
parent a04647aa8c
commit 89e095b4b5
17 changed files with 299 additions and 216 deletions

View file

@ -19,6 +19,11 @@ use Composer\DependencyResolver\Operation\UninstallOperation;
class InstallationManagerTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
$this->repository = $this->getMock('Composer\Repository\WritableRepositoryInterface');
}
public function testVendorDirOutsideTheWorkingDir()
{
$manager = new InstallationManager(realpath(getcwd().'/../'));
@ -67,22 +72,23 @@ class InstallationManagerTest extends \PHPUnit_Framework_TestCase
$this->createPackageMock(), $this->createPackageMock()
);
$manager
->expects($this->once())
->method('install')
->with($installOperation);
->with($this->repository, $installOperation);
$manager
->expects($this->once())
->method('uninstall')
->with($removeOperation);
->with($this->repository, $removeOperation);
$manager
->expects($this->once())
->method('update')
->with($updateOperation);
->with($this->repository, $updateOperation);
$manager->execute($installOperation);
$manager->execute($removeOperation);
$manager->execute($updateOperation);
$manager->execute($this->repository, $installOperation);
$manager->execute($this->repository, $removeOperation);
$manager->execute($this->repository, $updateOperation);
}
public function testInstall()
@ -108,9 +114,9 @@ class InstallationManagerTest extends \PHPUnit_Framework_TestCase
$installer
->expects($this->once())
->method('install')
->with($package);
->with($this->repository, $package);
$manager->install($operation);
$manager->install($this->repository, $operation);
}
public function testUpdateWithEqualTypes()
@ -141,9 +147,9 @@ class InstallationManagerTest extends \PHPUnit_Framework_TestCase
$installer
->expects($this->once())
->method('update')
->with($initial, $target);
->with($this->repository, $initial, $target);
$manager->update($operation);
$manager->update($this->repository, $operation);
}
public function testUpdateWithNotEqualTypes()
@ -183,14 +189,14 @@ class InstallationManagerTest extends \PHPUnit_Framework_TestCase
$libInstaller
->expects($this->once())
->method('uninstall')
->with($initial);
->with($this->repository, $initial);
$bundleInstaller
->expects($this->once())
->method('install')
->with($target);
->with($this->repository, $target);
$manager->update($operation);
$manager->update($this->repository, $operation);
}
public function testUninstall()
@ -210,7 +216,7 @@ class InstallationManagerTest extends \PHPUnit_Framework_TestCase
$installer
->expects($this->once())
->method('uninstall')
->with($package);
->with($this->repository, $package);
$installer
->expects($this->once())
@ -218,7 +224,7 @@ class InstallationManagerTest extends \PHPUnit_Framework_TestCase
->with('library')
->will($this->returnValue(true));
$manager->uninstall($operation);
$manager->uninstall($this->repository, $operation);
}
public function testGetVendorPathAbsolute()