public function viewAction() { $vendor = $this->params()->fromRoute('vendor', null); $module = $this->params()->fromRoute('module', null); $result = $this->moduleMapper->findByName($module); if (!$result) { return $this->notFoundAction(); } $repository = $this->repositoryRetriever->getUserRepositoryMetadata($vendor, $module); if (!$repository) { return $this->notFoundAction(); } $license = $this->repositoryRetriever->getRepositoryFileContent($vendor, $module, 'LICENSE'); $composerConf = $this->repositoryRetriever->getRepositoryFileContent($vendor, $module, 'composer.json'); $readme = $this->repositoryRetriever->getRepositoryFileContent($vendor, $module, 'README.md', true); return new ViewModel(['vendor' => $vendor, 'module' => $module, 'repository' => $repository, 'readme' => $readme, 'composerConf' => $composerConf, 'license' => $license]); }
public function testRepositoryFileContentFails() { $clientMock = $this->getMock('EdpGithub\\Client'); $clientMock->expects($this->any())->method('api')->willThrowException(new Exception\RuntimeException()); $service = new RepositoryRetriever($clientMock); $response = $service->getRepositoryFileContent('foo', 'bar', 'baz'); $this->assertFalse($response); }