public function testInitPerforceDoesNothingIfPerforceAlreadySet() { $perforce = $this->getMockBuilder('Composer\\Util\\Perforce')->disableOriginalConstructor()->getMock(); $this->downloader->setPerforce($perforce); $this->repository->expects($this->never())->method('getRepoConfig'); $this->downloader->initPerforce($this->package, $this->testPath, 'SOURCE_REF'); }
public function testInitPerforceGetRepoConfig() { $downloader = new PerforceDownloader($this->io, $this->config); $package = $this->getMock('Composer\\Package\\PackageInterface'); $repoConfig = array('url' => 'TEST_URL', 'p4user' => 'TEST_USER'); $repository = $this->getMock('Composer\\Repository\\VcsRepository', array('getRepoConfig'), array($repoConfig, $this->io, $this->config)); $package->expects($this->at(0))->method('getRepository')->will($this->returnValue($repository)); $repository->expects($this->at(0))->method('getRepoConfig'); $path = $this->testPath; $downloader->initPerforce($package, $path, 'SOURCE_REF'); }