public function it_will_return_new_entity_if_no_entity_found($repository, $factory, $em, GithubRepo $githubRepo, Tag $tagValueObject, GithubTag $githubTagEntity) { $tagValueObject->getName()->willReturn('master'); $repository->findOneByName($githubRepo, 'master')->willReturn(null); $factory->createFromValueObject($githubRepo, $tagValueObject)->willReturn($githubTagEntity); $em->persist($githubTagEntity)->shouldBeCalled(); $em->flush()->shouldBeCalled(); $this->getOrCreate($githubRepo, $tagValueObject)->shouldReturn($githubTagEntity); }
/** * @param GithubRepo $githubRepo * @param Tag $tagValueObject * * @return mixed */ public function get(GithubRepo $githubRepo, Tag $tagValueObject) { return $this->repository->findOneByName($githubRepo, $tagValueObject->getName()); }