public function testExtractRegisterInformation() { Phake::when($this->fileInfo)->getContents()->thenReturn($this->getRegisterInformation()); Phake::when($this->fileInfo)->getPathInfo()->thenReturn($this->fileInfo); Phake::when($this->fileInfo)->getRealPath()->thenReturn('/path/to/module'); $this->parser->extractRegisterInformation($this->fileInfo); Phake::verify($this->fileInfo)->getContents(); Phake::verify($this->fileInfo)->getPathInfo(); Phake::verify($this->fileInfo)->getRealPath(); }
/** * @param Event $event */ public function run(Event $event) { $result = array(); $this->finder->files()->ignoreDotFiles(false)->name($this->moduleContainer->getFilename())->in($this->moduleContainer->getPath()); /** @var SplFileInfo $file */ foreach ($this->finder as $file) { $moduleInfo = $this->parser->extractRegisterInformation($file); $result[$moduleInfo['namespace']] = $moduleInfo['source_dir']; } $this->dumper->dumpAutoloadPsr4($result); $this->dumper->dumpModulesInstalled($this->parser); }
/** * @param RegisterFileParser $parser */ public function dumpModulesInstalled(RegisterFileParser $parser) { $jsonToDump = json_encode($parser->getModuleList()); file_put_contents($this->vendorDir . '/composer/modules_installed.json', $jsonToDump); }