public function testUpgradeWithSameClassName() { $this->repository->expects($this->once())->method('getPackages')->will($this->returnValue(array($this->packages[1]))); $this->repository->expects($this->exactly(2))->method('hasPackage')->will($this->onConsecutiveCalls(true, false)); $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-v3', $installer->version); })); $installer->update($this->repository, $this->packages[1], $this->packages[2]); }