/** * @param GithubRepo $githubRepo * @param PullRequest $pullRequestValueObject * * @return GithubPullRequest */ public function createFromValueObject(GithubRepo $githubRepo, PullRequest $pullRequestValueObject) { $githubPullRequest = new GithubPullRequest(); $githubPullRequest->setRepo($githubRepo); $githubPullRequest->setNumber($pullRequestValueObject->getNumber()); $githubPullRequest->setTitle($pullRequestValueObject->getTitle()); $githubPullRequest->setBody($pullRequestValueObject->getBody()); $githubPullRequest->setState(GithubPullRequestState::convert($pullRequestValueObject->getState())); $githubPullRequest->setLocked($pullRequestValueObject->isLocked()); $githubPullRequest->setMerged($pullRequestValueObject->isMerged()); $githubPullRequest->setGithubCreatedAt($pullRequestValueObject->getGithubCreatedAt()); $githubPullRequest->setGithubUpdatedAt($pullRequestValueObject->getGithubUpdatedAt()); $this->mapper->map($pullRequestValueObject, $githubPullRequest); return $githubPullRequest; }
/** * @param GithubPullRequestDataInterface $remote * @param GithubPullRequest $entity * * @return bool */ public function map(GithubPullRequestDataInterface $remote, GithubPullRequest $entity) { $entity->setTitle($remote->getTitle()); return true; }
public function it_will_map_property_values_from_remote_to_entity(GithubPullRequestDataInterface $remote, GithubPullRequest $entity) { $remote->getTitle()->willReturn('name'); $entity->setTitle('name')->shouldBeCalled(); $this->map($remote, $entity)->shouldReturn(true); }