/** * @covers Sp\BowerBundle\Bower\Bower::createDependencyMappingCache */ public function testCreateDependencyMappingCache() { $configDir = __DIR__ . "/Fixtures/config"; $jsonFile = 'bower.json'; $jsonFilePath = $configDir . "/" . $jsonFile; $config = new Configuration($configDir); $config->setJsonFile($jsonFile); $config->setCache($this->cache); $jsonDependencyMapping = file_get_contents(self::$fixturesDirectory . '/dependency_mapping.json'); $arrayDependencyMapping = (require self::$fixturesDirectory . '/dependency_mapping.php'); $this->processBuilder->expects($this->once())->method('setWorkingDirectory')->with($this->equalTo($configDir)); $this->processBuilder->expects($this->once())->method('setTimeout')->with($this->equalTo(600)); $this->processBuilder->expects($this->at(2))->method('add')->with($this->equalTo($this->bin)); $this->processBuilder->expects($this->at(3))->method('add')->with($this->equalTo('list')); $this->processBuilder->expects($this->at(4))->method('add')->with($this->equalTo('--json')); $this->processBuilder->expects($this->once())->method('getProcess')->will($this->returnValue($this->process)); $this->process->expects($this->once())->method('isSuccessful')->will($this->returnValue(true)); $this->bower->expects($this->once())->method('dumpBowerConfig'); $this->eventDispatcher->expects($this->at(0))->method('dispatch')->with($this->equalTo(BowerEvents::PRE_EXEC)); $this->eventDispatcher->expects($this->at(1))->method('dispatch')->with($this->equalTo(BowerEvents::POST_EXEC)); $this->process->expects($this->once())->method('run')->with($this->equalTo(null)); $this->process->expects($this->once())->method('getOutput')->will($this->returnValue($jsonDependencyMapping)); $this->cache->expects($this->once())->method('save')->with($this->equalTo(hash_file('sha1', $jsonFilePath)), $this->equalTo($arrayDependencyMapping)); $this->bower->createDependencyMappingCache($config); }