public function it_will_fetch_repo_details_from_github($authenticatedClientFactory, $githubRepoDataFactory, GithubRepoDataInterface $githubRepo, User $user, Client $client, Repo $repoApi, GithubRepoData $githubRepoData)
 {
     $githubRepo->getOwner()->willReturn('owner');
     $githubRepo->getName()->willReturn('name');
     $authenticatedClientFactory->create($user)->willReturn($client);
     $client->api('repository')->willReturn($repoApi);
     $repoApi->show('owner', 'name')->willReturn(['data']);
     $githubRepoDataFactory->create(['data'])->willReturn($githubRepoData);
     $this->fetch($githubRepo, $user)->shouldReturn($githubRepoData);
 }
 public function it_will_fetch_all_branches_from_github($authenticatedClientFactory, $githubBranchDataFactory, GithubRepoDataInterface $githubRepo, User $user, Client $client, RepoApi $repoApi, GithubBranchData $githubBranchData)
 {
     $githubRepo->getOwner()->willReturn('owner');
     $githubRepo->getName()->willReturn('name');
     $authenticatedClientFactory->create($user)->willReturn($client);
     $client->api('repository')->willReturn($repoApi);
     $repoApi->branches('owner', 'name')->willReturn([['name' => 'master']]);
     $repoApi->branches('owner', 'name', 'master')->willReturn(['data']);
     $githubBranchDataFactory->create(['data'])->willReturn($githubBranchData);
     $this->fetchAll($githubRepo, $user)->shouldReturn([$githubBranchData]);
 }
 /**
  * @param GithubRepoDataInterface $githubRepo
  * @param User                    $user
  *
  * @return array
  */
 public function fetchAll(GithubRepoDataInterface $githubRepo, User $user)
 {
     $client = $this->createClient($user);
     $remoteData = $client->api('repository')->tages($githubRepo->getOwner(), $githubRepo->getName());
     $results = [];
     foreach ($remoteData as $tagRemoteData) {
         $remoteData = $client->api('repository')->tages($githubRepo->getOwner(), $githubRepo->getName(), $tagRemoteData['name']);
         $results[] = $this->githubTagDataFactory->create($remoteData);
     }
     return $results;
 }
示例#4
0
 /**
  * @param GithubRepoData|GithubRepoDataInterface $remote
  * @param GithubRepo                             $entity
  *
  * @return bool
  */
 public function map(GithubRepoDataInterface $remote, GithubRepo $entity)
 {
     $entity->setGithubId($remote->getGithubId());
     $entity->setOwner($remote->getOwner());
     $entity->setName($remote->getName());
     $entity->setFullName($remote->getFullName());
     $entity->setHtmlUrl($remote->getHtmlUrl());
     $entity->setDescription($remote->getDescription());
     $entity->setFork($remote->getFork());
     $entity->setDefaultBranch($remote->getDefaultBranch());
     $entity->setGithubPrivate($remote->getGithubPrivate());
     $entity->setGitUrl($remote->getGitUrl());
     $entity->setSshUrl($remote->getSshUrl());
     $entity->setGithubCreatedAt($remote->getGithubCreatedAt());
     $entity->setGithubUpdatedAt($remote->getGithubUpdatedAt());
     $entity->setGithubPushedAt($remote->getGithubPushedAt());
     return true;
 }
 /**
  * @param GithubRepoDataInterface $githubRepo
  * @param User                    $user
  *
  * @return mixed
  */
 public function fetch(GithubRepoDataInterface $githubRepo, User $user)
 {
     $client = $this->createClient($user);
     $remoteData = $client->api('repository')->show($githubRepo->getOwner(), $githubRepo->getName());
     return $this->githubRepoDataFactory->create($remoteData);
 }
 /**
  * @param Repo|GithubRepoDataInterface $repoValueObject
  *
  * @return mixed
  */
 public function get(GithubRepoDataInterface $repoValueObject)
 {
     return $this->repository->findOneByFullName($repoValueObject->getFullName());
 }
示例#7
0
 /**
  * @param GithubRepoDataInterface $repo
  *
  * @return \Symfony\Component\Form\FormView
  */
 public function getNew(GithubRepoDataInterface $repo)
 {
     $form = clone $this->form;
     $form->get('projectName')->setData($repo->getFullName());
     return $form->createView();
 }