Browse Source

Fix tests

Jordi Boggiano 13 years ago
parent
commit
e4dbee2648

+ 1 - 4
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 <francois.pluchino@opendisplay.com>
  */
-interface IOInterface extends OutputInterface
+interface IOInterface
 {
     /**
      * Is this input means interactive?

+ 6 - 4
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

+ 12 - 9
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