From e4dbee2648053f596ce50f2d245b7f2474387b19 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 17 Jan 2012 23:13:35 +0100 Subject: [PATCH] Fix tests --- src/Composer/IO/IOInterface.php | 5 +---- .../Test/Installer/InstallerInstallerTest.php | 10 +++++---- .../Test/Installer/LibraryInstallerTest.php | 21 +++++++++++-------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/Composer/IO/IOInterface.php b/src/Composer/IO/IOInterface.php index aca57ad25..311901529 100644 --- a/src/Composer/IO/IOInterface.php +++ b/src/Composer/IO/IOInterface.php @@ -12,15 +12,12 @@ namespace Composer\IO; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Helper\HelperSet; - /** * The Input/Output helper interface. * * @author François Pluchino */ -interface IOInterface extends OutputInterface +interface IOInterface { /** * Is this input means interactive? diff --git a/tests/Composer/Test/Installer/InstallerInstallerTest.php b/tests/Composer/Test/Installer/InstallerInstallerTest.php index 0c1d24f75..4e2f8c732 100644 --- a/tests/Composer/Test/Installer/InstallerInstallerTest.php +++ b/tests/Composer/Test/Installer/InstallerInstallerTest.php @@ -35,7 +35,9 @@ class InstallerInstallerTest extends \PHPUnit_Framework_TestCase ->getMock(); $this->repository = $this->getMockBuilder('Composer\Repository\WritableRepositoryInterface') - ->disableOriginalConstructor() + ->getMock(); + + $this->io = $this->getMockBuilder('Composer\IO\IOInterface') ->getMock(); } @@ -45,7 +47,7 @@ class InstallerInstallerTest extends \PHPUnit_Framework_TestCase ->expects($this->once()) ->method('getPackages') ->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; $this->im @@ -68,7 +70,7 @@ class InstallerInstallerTest extends \PHPUnit_Framework_TestCase ->expects($this->once()) ->method('hasPackage') ->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; $this->im @@ -91,7 +93,7 @@ class InstallerInstallerTest extends \PHPUnit_Framework_TestCase ->expects($this->once()) ->method('hasPackage') ->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; $this->im diff --git a/tests/Composer/Test/Installer/LibraryInstallerTest.php b/tests/Composer/Test/Installer/LibraryInstallerTest.php index b8134763a..ed655f983 100644 --- a/tests/Composer/Test/Installer/LibraryInstallerTest.php +++ b/tests/Composer/Test/Installer/LibraryInstallerTest.php @@ -23,6 +23,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase private $dm; private $repository; private $library; + private $io; protected function setUp() { @@ -45,25 +46,27 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase ->getMock(); $this->repository = $this->getMockBuilder('Composer\Repository\WritableRepositoryInterface') - ->disableOriginalConstructor() + ->getMock(); + + $this->io = $this->getMockBuilder('Composer\IO\IOInterface') ->getMock(); } 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)); $file = sys_get_temp_dir().'/file'; touch($file); $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() { - $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(); $this->repository @@ -78,7 +81,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase 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 @@ -101,7 +104,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase 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(); $target = $this->createPackageMock(); @@ -140,7 +143,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase 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 @@ -174,7 +177,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase 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 @@ -187,7 +190,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase 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