Fix tests
parent
434c9ecdeb
commit
e4dbee2648
|
@ -12,15 +12,12 @@
|
||||||
|
|
||||||
namespace Composer\IO;
|
namespace Composer\IO;
|
||||||
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
|
||||||
use Symfony\Component\Console\Helper\HelperSet;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Input/Output helper interface.
|
* The Input/Output helper interface.
|
||||||
*
|
*
|
||||||
* @author François Pluchino <francois.pluchino@opendisplay.com>
|
* @author François Pluchino <francois.pluchino@opendisplay.com>
|
||||||
*/
|
*/
|
||||||
interface IOInterface extends OutputInterface
|
interface IOInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Is this input means interactive?
|
* Is this input means interactive?
|
||||||
|
|
|
@ -35,7 +35,9 @@ class InstallerInstallerTest extends \PHPUnit_Framework_TestCase
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$this->repository = $this->getMockBuilder('Composer\Repository\WritableRepositoryInterface')
|
$this->repository = $this->getMockBuilder('Composer\Repository\WritableRepositoryInterface')
|
||||||
->disableOriginalConstructor()
|
->getMock();
|
||||||
|
|
||||||
|
$this->io = $this->getMockBuilder('Composer\IO\IOInterface')
|
||||||
->getMock();
|
->getMock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +47,7 @@ class InstallerInstallerTest extends \PHPUnit_Framework_TestCase
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getPackages')
|
->method('getPackages')
|
||||||
->will($this->returnValue(array()));
|
->will($this->returnValue(array()));
|
||||||
$installer = new InstallerInstallerMock(__DIR__.'/Fixtures/', __DIR__.'/Fixtures/bin', $this->dm, $this->repository, $this->im);
|
$installer = new InstallerInstallerMock(__DIR__.'/Fixtures/', __DIR__.'/Fixtures/bin', $this->dm, $this->repository, $this->io, $this->im);
|
||||||
|
|
||||||
$test = $this;
|
$test = $this;
|
||||||
$this->im
|
$this->im
|
||||||
|
@ -68,7 +70,7 @@ class InstallerInstallerTest extends \PHPUnit_Framework_TestCase
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('hasPackage')
|
->method('hasPackage')
|
||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
$installer = new InstallerInstallerMock(__DIR__.'/Fixtures/', __DIR__.'/Fixtures/bin', $this->dm, $this->repository, $this->im);
|
$installer = new InstallerInstallerMock(__DIR__.'/Fixtures/', __DIR__.'/Fixtures/bin', $this->dm, $this->repository, $this->io, $this->im);
|
||||||
|
|
||||||
$test = $this;
|
$test = $this;
|
||||||
$this->im
|
$this->im
|
||||||
|
@ -91,7 +93,7 @@ class InstallerInstallerTest extends \PHPUnit_Framework_TestCase
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('hasPackage')
|
->method('hasPackage')
|
||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
$installer = new InstallerInstallerMock(__DIR__.'/Fixtures/', __DIR__.'/Fixtures/bin', $this->dm, $this->repository, $this->im);
|
$installer = new InstallerInstallerMock(__DIR__.'/Fixtures/', __DIR__.'/Fixtures/bin', $this->dm, $this->repository, $this->io, $this->im);
|
||||||
|
|
||||||
$test = $this;
|
$test = $this;
|
||||||
$this->im
|
$this->im
|
||||||
|
|
|
@ -23,6 +23,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
|
||||||
private $dm;
|
private $dm;
|
||||||
private $repository;
|
private $repository;
|
||||||
private $library;
|
private $library;
|
||||||
|
private $io;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
|
@ -45,25 +46,27 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$this->repository = $this->getMockBuilder('Composer\Repository\WritableRepositoryInterface')
|
$this->repository = $this->getMockBuilder('Composer\Repository\WritableRepositoryInterface')
|
||||||
->disableOriginalConstructor()
|
->getMock();
|
||||||
|
|
||||||
|
$this->io = $this->getMockBuilder('Composer\IO\IOInterface')
|
||||||
->getMock();
|
->getMock();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testInstallerCreation()
|
public function testInstallerCreation()
|
||||||
{
|
{
|
||||||
$library = new LibraryInstaller($this->vendorDir, $this->binDir, $this->dm, $this->repository);
|
$library = new LibraryInstaller($this->vendorDir, $this->binDir, $this->dm, $this->repository, $this->io);
|
||||||
$this->assertTrue(is_dir($this->vendorDir));
|
$this->assertTrue(is_dir($this->vendorDir));
|
||||||
|
|
||||||
$file = sys_get_temp_dir().'/file';
|
$file = sys_get_temp_dir().'/file';
|
||||||
touch($file);
|
touch($file);
|
||||||
|
|
||||||
$this->setExpectedException('RuntimeException');
|
$this->setExpectedException('RuntimeException');
|
||||||
$library = new LibraryInstaller($file, $this->binDir, $this->dm, $this->repository);
|
$library = new LibraryInstaller($file, $this->binDir, $this->dm, $this->repository, $this->io);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsInstalled()
|
public function testIsInstalled()
|
||||||
{
|
{
|
||||||
$library = new LibraryInstaller($this->vendorDir, $this->binDir, $this->dm, $this->repository);
|
$library = new LibraryInstaller($this->vendorDir, $this->binDir, $this->dm, $this->repository, $this->io);
|
||||||
$package = $this->createPackageMock();
|
$package = $this->createPackageMock();
|
||||||
|
|
||||||
$this->repository
|
$this->repository
|
||||||
|
@ -78,7 +81,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testInstall()
|
public function testInstall()
|
||||||
{
|
{
|
||||||
$library = new LibraryInstaller($this->vendorDir, $this->binDir, $this->dm, $this->repository);
|
$library = new LibraryInstaller($this->vendorDir, $this->binDir, $this->dm, $this->repository, $this->io);
|
||||||
$package = $this->createPackageMock();
|
$package = $this->createPackageMock();
|
||||||
|
|
||||||
$package
|
$package
|
||||||
|
@ -101,7 +104,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testUpdate()
|
public function testUpdate()
|
||||||
{
|
{
|
||||||
$library = new LibraryInstaller($this->vendorDir, $this->binDir, $this->dm, $this->repository);
|
$library = new LibraryInstaller($this->vendorDir, $this->binDir, $this->dm, $this->repository, $this->io);
|
||||||
$initial = $this->createPackageMock();
|
$initial = $this->createPackageMock();
|
||||||
$target = $this->createPackageMock();
|
$target = $this->createPackageMock();
|
||||||
|
|
||||||
|
@ -140,7 +143,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testUninstall()
|
public function testUninstall()
|
||||||
{
|
{
|
||||||
$library = new LibraryInstaller($this->vendorDir, $this->binDir, $this->dm, $this->repository);
|
$library = new LibraryInstaller($this->vendorDir, $this->binDir, $this->dm, $this->repository, $this->io);
|
||||||
$package = $this->createPackageMock();
|
$package = $this->createPackageMock();
|
||||||
|
|
||||||
$package
|
$package
|
||||||
|
@ -174,7 +177,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testGetInstallPath()
|
public function testGetInstallPath()
|
||||||
{
|
{
|
||||||
$library = new LibraryInstaller($this->vendorDir, $this->binDir, $this->dm, $this->repository);
|
$library = new LibraryInstaller($this->vendorDir, $this->binDir, $this->dm, $this->repository, $this->io);
|
||||||
$package = $this->createPackageMock();
|
$package = $this->createPackageMock();
|
||||||
|
|
||||||
$package
|
$package
|
||||||
|
@ -187,7 +190,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testGetInstallPathWithTargetDir()
|
public function testGetInstallPathWithTargetDir()
|
||||||
{
|
{
|
||||||
$library = new LibraryInstaller($this->vendorDir, $this->binDir, $this->dm, $this->repository);
|
$library = new LibraryInstaller($this->vendorDir, $this->binDir, $this->dm, $this->repository, $this->io);
|
||||||
$package = $this->createPackageMock();
|
$package = $this->createPackageMock();
|
||||||
|
|
||||||
$package
|
$package
|
||||||
|
|
Loading…
Reference in New Issue