public function it_will_fetch_branch_details_from_github($authenticatedClientFactory, $githubBranchDataFactory, GithubRepoDataInterface $githubRepo, GithubBranchDataInterface $githubBranch, User $user, Client $client, RepoApi $repoApi, GithubBranchData $githubBranchData)
 {
     $githubRepo->getOwner()->willReturn('owner');
     $githubRepo->getName()->willReturn('name');
     $githubBranch->getName()->willReturn('master');
     $authenticatedClientFactory->create($user)->willReturn($client);
     $client->api('repository')->willReturn($repoApi);
     $repoApi->branches('owner', 'name', 'master')->willReturn(['data']);
     $githubBranchDataFactory->create(['data'])->willReturn($githubBranchData);
     $this->fetch($githubRepo, $githubBranch, $user)->shouldReturn($githubBranchData);
 }
Пример #2
0
 /**
  * @param GithubBranchDataInterface $remote
  * @param GithubBranch              $entity
  *
  * @return bool
  */
 public function map(GithubBranchDataInterface $remote, GithubBranch $entity)
 {
     $entity->setName($remote->getName());
     return true;
 }
Пример #3
0
 public function it_will_map_property_values_from_remote_to_entity(GithubBranchDataInterface $remote, GithubBranch $entity)
 {
     $remote->getName()->willReturn('name');
     $entity->setName('name')->shouldBeCalled();
     $this->map($remote, $entity)->shouldReturn(true);
 }
 /**
  * @param GithubRepoDataInterface   $githubRepo
  * @param GithubBranchDataInterface $githubBranch
  * @param User                      $user
  *
  * @return mixed
  */
 public function fetch(GithubRepoDataInterface $githubRepo, GithubBranchDataInterface $githubBranch, User $user)
 {
     $client = $this->createClient($user);
     $remoteData = $client->api('repository')->branches($githubRepo->getOwner(), $githubRepo->getName(), $githubBranch->getName());
     return $this->githubBranchDataFactory->create($remoteData);
 }