예제 #1
0
 /**
  * @param GithubRepo $githubRepo
  * @param Branch     $branchValueObject
  *
  * @return GithubBranch
  */
 public function createFromValueObject(GithubRepo $githubRepo, Branch $branchValueObject)
 {
     $githubBranch = new GithubBranch();
     $githubBranch->setRepo($githubRepo);
     $this->mapper->map($branchValueObject, $githubBranch);
     return $githubBranch;
 }
예제 #2
0
 /**
  * @Given there is :branchName branch on :githubRepoFullName github repo
  *
  * @param $branchName
  * @param $githubRepoFullName
  *
  * @throws \Exception
  */
 public function thereIsBranchOnGithubRepo($branchName, $githubRepoFullName)
 {
     $branch = new GithubBranch();
     $branch->setName($branchName)->setRepo($this->getGithubRepoByFullName($githubRepoFullName));
     $this->save($branch);
 }
예제 #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);
 }
예제 #4
0
 /**
  * @When I fill in details for :message github commit
  *
  * @param $message
  */
 public function iFillInDetailsForGithubCommit($message)
 {
     $this->target->setSha('sha1')->setMessage($message)->setGithubRepo($this->repo)->setAuthorDate(new \DateTime('2015-01-05 06:07:08'))->setCommitterDate(new \DateTime('2015-01-05 06:07:08'));
     $this->branch->setLastCommit($this->target);
     $this->validateAndSave($this->branch);
 }
예제 #5
0
 /**
  * @param $name
  *
  * @return GithubBranch
  */
 private function createBranchObjectFromBranchName($name)
 {
     $branch = new GithubBranch();
     $branch->setName($name);
     return $branch;
 }
예제 #6
0
 /**
  * @param GithubBranchDataInterface $remote
  * @param GithubBranch              $entity
  *
  * @return bool
  */
 public function map(GithubBranchDataInterface $remote, GithubBranch $entity)
 {
     $entity->setName($remote->getName());
     return true;
 }
예제 #7
0
 /**
  * @param \DevBoard\Github\Branch\Entity\GithubBranch  $masterBranch
  * @param \DevBoard\Github\Branch\Entity\GithubBranch  $devBranch
  * @param \Doctrine\Common\Collections\ArrayCollection $collection
  */
 public function it_can_return_branch_if_exists_on_repo($masterBranch, $devBranch, $collection)
 {
     $masterBranch->getName()->willReturn('master')->shouldBeCalled();
     $devBranch->getName()->willReturn('dev')->shouldBeCalled();
     $collection->getIterator()->willReturn(new \ArrayIterator([$masterBranch->getWrappedObject(), $devBranch->getWrappedObject()]));
     $this->setBranches($collection);
     $this->getBranchByName('dev')->shouldReturn($devBranch);
 }