Пример #1
0
 /**
  * @param string $fullName
  *
  * @return GithubRepo
  */
 public function create($fullName)
 {
     list($owner, $name) = explode('/', $fullName);
     $githubRepo = new GithubRepo();
     $githubRepo->setOwner($owner);
     $githubRepo->setName($name);
     return $githubRepo;
 }
Пример #2
0
 /**
  * @param string $fullName
  *
  * @return GithubRepo
  */
 private function createRepoObjectFromFullName($fullName)
 {
     list($owner, $name) = explode('/', $fullName);
     $githubRepo = new GithubRepo();
     $githubRepo->setOwner($owner);
     $githubRepo->setName($name);
     return $githubRepo;
 }
Пример #3
0
 public function let(Client $client, HookSettings $hookSettings, GithubRepo $githubRepo, Repo $repo, Hooks $hooks)
 {
     $githubRepo->getOwner()->willReturn('owner');
     $githubRepo->getName()->willReturn('repository');
     $client->repo()->willReturn($repo);
     $repo->hooks()->willReturn($hooks);
     $hookSettings->getCreateHookParams()->willReturn(['params']);
     $this->beConstructedWith($client, $hookSettings, $githubRepo);
 }
 public function it_will_fetch_commit_details_from_github($authenticatedClientFactory, $githubCommitDataFactory, GithubCommitDataInterface $githubCommit, GithubRepo $githubRepo, User $user, Client $client, Repo $repositoryApi, Commits $commitApi, GithubCommitData $githubCommitData)
 {
     $githubRepo->getOwner()->willReturn('owner');
     $githubRepo->getName()->willReturn('name');
     $githubCommit->getSha()->willReturn('sha');
     $authenticatedClientFactory->create($user)->willReturn($client);
     $client->api('repository')->willReturn($repositoryApi);
     $repositoryApi->commits()->willReturn($commitApi);
     $commitApi->show('owner', 'name', 'sha')->willReturn(['data']);
     $githubCommitDataFactory->create($githubRepo, ['data'])->willReturn($githubCommitData);
     $this->fetch($githubCommit, $githubRepo, $user)->shouldReturn($githubCommitData);
 }
Пример #5
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;
 }
Пример #6
0
 public function it_will_map_property_values_from_remote_to_entity(GithubRepoData $remote, GithubRepo $entity, $githubId, $owner, $name, $fullName, $htmlUrl, $description, $fork, $defaultBranch, $githubPrivate, $gitUrl, $sshUrl, DateTime $githubCreatedAt, DateTime $githubUpdatedAt, DateTime $githubPushedAt)
 {
     $remote->getGithubId()->willReturn($githubId);
     $remote->getOwner()->willReturn($owner);
     $remote->getName()->willReturn($name);
     $remote->getFullName()->willReturn($fullName);
     $remote->getHtmlUrl()->willReturn($htmlUrl);
     $remote->getDescription()->willReturn($description);
     $remote->getFork()->willReturn($fork);
     $remote->getDefaultBranch()->willReturn($defaultBranch);
     $remote->getGithubPrivate()->willReturn($githubPrivate);
     $remote->getGitUrl()->willReturn($gitUrl);
     $remote->getSshUrl()->willReturn($sshUrl);
     $remote->getGithubCreatedAt()->willReturn($githubCreatedAt);
     $remote->getGithubUpdatedAt()->willReturn($githubUpdatedAt);
     $remote->getGithubPushedAt()->willReturn($githubPushedAt);
     $entity->setGithubId($githubId)->shouldBeCalled();
     $entity->setOwner($owner)->shouldBeCalled();
     $entity->setName($name)->shouldBeCalled();
     $entity->setFullName($fullName)->shouldBeCalled();
     $entity->setHtmlUrl($htmlUrl)->shouldBeCalled();
     $entity->setDescription($description)->shouldBeCalled();
     $entity->setFork($fork)->shouldBeCalled();
     $entity->setDefaultBranch($defaultBranch)->shouldBeCalled();
     $entity->setGithubPrivate($githubPrivate)->shouldBeCalled();
     $entity->setGitUrl($gitUrl)->shouldBeCalled();
     $entity->setSshUrl($sshUrl)->shouldBeCalled();
     $entity->setGithubCreatedAt($githubCreatedAt)->shouldBeCalled();
     $entity->setGithubUpdatedAt($githubUpdatedAt)->shouldBeCalled();
     $entity->setGithubPushedAt($githubPushedAt)->shouldBeCalled();
     $this->map($remote, $entity)->shouldReturn(true);
 }