Exemplo n.º 1
0
 public function testInstallNewInstaller()
 {
     $this->repository->expects($this->once())->method('getPackages')->will($this->returnValue(array()));
     $installer = new InstallerInstallerMock(__DIR__ . '/Fixtures/', __DIR__ . '/Fixtures/bin', $this->dm, $this->io, $this->im, array($this->repository));
     $test = $this;
     $this->im->expects($this->once())->method('addInstaller')->will($this->returnCallback(function ($installer) use($test) {
         $test->assertEquals('installer-v1', $installer->version);
     }));
     $installer->install($this->repository, $this->packages[0]);
 }
 public function testInstallMultipleInstallers()
 {
     $this->repository->expects($this->once())->method('getPackages')->will($this->returnValue(array()));
     $installer = new InstallerInstallerMock($this->io, $this->composer);
     $test = $this;
     $this->im->expects($this->at(0))->method('addInstaller')->will($this->returnCallback(function ($installer) use($test) {
         $test->assertEquals('custom1', $installer->name);
         $test->assertEquals('installer-v4', $installer->version);
     }));
     $this->im->expects($this->at(1))->method('addInstaller')->will($this->returnCallback(function ($installer) use($test) {
         $test->assertEquals('custom2', $installer->name);
         $test->assertEquals('installer-v4', $installer->version);
     }));
     $installer->install($this->repository, $this->packages[3]);
 }