@ -30,7 +30,7 @@ class InstallationManagerTest extends \PHPUnit_Framework_TestCase
return $arg === 'vendor';
return $arg === 'vendor';
}));
}));
$manager = new InstallationManager();
$manager = new InstallationManager('vendor' );
$manager->addInstaller($installer);
$manager->addInstaller($installer);
$this->assertSame($installer, $manager->getInstaller('vendor'));
$this->assertSame($installer, $manager->getInstaller('vendor'));
@ -43,6 +43,7 @@ class InstallationManagerTest extends \PHPUnit_Framework_TestCase
{
{
$manager = $this->getMockBuilder('Composer\Installer\InstallationManager')
$manager = $this->getMockBuilder('Composer\Installer\InstallationManager')
->setMethods(array('install', 'update', 'uninstall'))
->setMethods(array('install', 'update', 'uninstall'))
->setConstructorArgs(array('vendor'))
->getMock();
->getMock();
$installOperation = new InstallOperation($this->createPackageMock());
$installOperation = new InstallOperation($this->createPackageMock());
@ -72,7 +73,7 @@ class InstallationManagerTest extends \PHPUnit_Framework_TestCase
public function testInstall()
public function testInstall()
{
{
$installer = $this->createInstallerMock();
$installer = $this->createInstallerMock();
$manager = new InstallationManager();
$manager = new InstallationManager('vendor' );
$manager->addInstaller($installer);
$manager->addInstaller($installer);
$package = $this->createPackageMock();
$package = $this->createPackageMock();
@ -100,7 +101,7 @@ class InstallationManagerTest extends \PHPUnit_Framework_TestCase
public function testUpdateWithEqualTypes()
public function testUpdateWithEqualTypes()
{
{
$installer = $this->createInstallerMock();
$installer = $this->createInstallerMock();
$manager = new InstallationManager();
$manager = new InstallationManager('vendor' );
$manager->addInstaller($installer);
$manager->addInstaller($installer);
$initial = $this->createPackageMock();
$initial = $this->createPackageMock();
@ -134,7 +135,7 @@ class InstallationManagerTest extends \PHPUnit_Framework_TestCase
{
{
$libInstaller = $this->createInstallerMock();
$libInstaller = $this->createInstallerMock();
$bundleInstaller = $this->createInstallerMock();
$bundleInstaller = $this->createInstallerMock();
$manager = new InstallationManager();
$manager = new InstallationManager('vendor' );
$manager->addInstaller($libInstaller);
$manager->addInstaller($libInstaller);
$manager->addInstaller($bundleInstaller);
$manager->addInstaller($bundleInstaller);
@ -180,7 +181,7 @@ class InstallationManagerTest extends \PHPUnit_Framework_TestCase
public function testUninstall()
public function testUninstall()
{
{
$installer = $this->createInstallerMock();
$installer = $this->createInstallerMock();
$manager = new InstallationManager();
$manager = new InstallationManager('vendor' );
$manager->addInstaller($installer);
$manager->addInstaller($installer);
$package = $this->createPackageMock();
$package = $this->createPackageMock();
@ -205,6 +206,18 @@ class InstallationManagerTest extends \PHPUnit_Framework_TestCase
$manager->uninstall($operation);
$manager->uninstall($operation);
}
}
public function testGetVendorPathAbsolute()
{
$manager = new InstallationManager('vendor');
$this->assertEquals(realpath('').DIRECTORY_SEPARATOR.'vendor', $manager->getVendorPath(true));
}
public function testGetVendorPathRelative()
{
$manager = new InstallationManager('vendor');
$this->assertEquals('vendor', $manager->getVendorPath());
}
private function createInstallerMock()
private function createInstallerMock()
{
{
return $this->getMockBuilder('Composer\Installer\InstallerInterface')
return $this->getMockBuilder('Composer\Installer\InstallerInterface')