예제 #1
0
 public function it_will_return_new_entity_if_no_entity_found($repository, $factory, $em, GithubRepo $githubRepo, Branch $branchValueObject, GithubBranch $githubBranchEntity)
 {
     $branchValueObject->getName()->willReturn('master');
     $repository->findOneByName($githubRepo, 'master')->willReturn(null);
     $factory->createFromValueObject($githubRepo, $branchValueObject)->willReturn($githubBranchEntity);
     $em->persist($githubBranchEntity)->shouldBeCalled();
     $em->flush()->shouldBeCalled();
     $this->getOrCreate($githubRepo, $branchValueObject)->shouldReturn($githubBranchEntity);
 }
예제 #2
0
 /**
  * @param GithubRepo $githubRepo
  * @param Branch     $branchValueObject
  *
  * @return mixed
  */
 public function get(GithubRepo $githubRepo, Branch $branchValueObject)
 {
     return $this->repository->findOneByName($githubRepo, $branchValueObject->getName());
 }