Example #1
0
 public function it_will_create_remote_commit_value_object(PullRequestPayload $pullRequestPayload)
 {
     $data = ['sha' => 'sha'];
     $pullRequestPayload->getHeadCommitDetails()->willReturn($data);
     $result = $this->create($pullRequestPayload);
     $result->shouldReturnAnInstanceOf('DevBoard\\GithubRemote\\ValueObject\\Commit\\Commit');
 }
 public function it_will_create_remote_pullRequest_value_object(PullRequestPayload $pullRequestPayload)
 {
     $data = ['number' => 169, 'state' => 'open', 'locked' => false, 'title' => 'title', 'user' => ['login' => 'devboard-john', 'id' => 123, 'avatar_url' => 'https://avatars.githubusercontent.com/u/123?v=3'], 'body' => 'body', 'created_at' => '2015-12-06T14:43:34Z', 'updated_at' => '2015-12-06T14:43:34Z', 'assignee' => null, 'head' => ['label' => 'devboard-john:168-clean-up-services', 'ref' => '168-clean-up-services', 'sha' => '0a32e2351a426211b6bffaf271cb6bc005fc67c9', 'user' => ['login' => 'devboard-john', 'id' => 123, 'avatar_url' => 'https://avatars.githubusercontent.com/u/123?v=3'], 'repo' => ['id' => 39307551, 'name' => 'devboard', 'full_name' => 'devboard-john/devboard', 'owner' => ['login' => 'devboard-john', 'id' => 123, 'avatar_url' => 'https://avatars.githubusercontent.com/u/123?v=3']]], 'base' => ['label' => 'devboard:master', 'ref' => 'master', 'sha' => 'cf2a0df3f01811bfeab22981b259b41bf5d344c4', 'user' => ['login' => 'devboard', 'id' => 13396338, 'avatar_url' => 'https://avatars.githubusercontent.com/u/13396338?v=3'], 'repo' => ['id' => 39307548, 'name' => 'devboard', 'full_name' => 'devboard/devboard', 'owner' => ['login' => 'devboard', 'id' => 13396338, 'avatar_url' => 'https://avatars.githubusercontent.com/u/13396338?v=3']]], '_links' => [], 'merged' => false, 'mergeable' => null, 'mergeable_state' => 'unknown', 'merged_by' => null, 'comments' => 0, 'review_comments' => 0, 'commits' => 2, 'additions' => 193, 'deletions' => 184, 'changed_files' => 10];
     $pullRequestPayload->getPullRequestDetails()->willReturn($data);
     $result = $this->create($pullRequestPayload);
     $result->shouldReturnAnInstanceOf('DevBoard\\GithubRemote\\ValueObject\\PullRequest\\PullRequest');
 }
 public function it_will_create_remote_commit_author_value_object(PullRequestPayload $pullRequestPayload)
 {
     $data = ['login' => 'username', 'id' => 123, 'avatar_url' => 'https://avatars.githubusercontent.com/u/123?v=3'];
     $pullRequestPayload->getPullRequestCreatorDetails()->willReturn($data);
     $result = $this->create($pullRequestPayload);
     $result->shouldReturnAnInstanceOf('DevBoard\\GithubRemote\\ValueObject\\User\\PullRequestCreator');
     $result->getName()->shouldReturn(null);
     $result->getEmail()->shouldReturn(null);
     $result->getGithubId()->shouldReturn(123);
     $result->getUsername()->shouldReturn('username');
     $result->getAvatarUrl()->shouldReturn('https://avatars.githubusercontent.com/u/123?v=3');
 }
 public function it_will_create($repoFactory, $pullRequestFactory, $commitFactory, $pullRequestCreatorFactory, $pullRequestAssigneeFactory, $githubRepoFacade, $githubPullRequestFacade, $githubCommitFacade, $githubUserFacade, $em, PullRequestPayload $pullRequestPayload, Repo $repoValueObject, PullRequest $pullRequestValueObject, Commit $commitValueObject, CommitAuthor $pullRequestCreatorValueObject, CommitCommitter $pullRequestAssigneeValueObject, GithubRepo $githubRepoEntity, GithubPullRequest $githubPullRequestEntity, GithubCommit $githubCommitEntity, GithubUser $githubPullRequestCreatorEntity, GithubUser $githubPullRequestAssigneeEntity)
 {
     $pullRequestPayload->getPullRequestAssigneeDetails()->willReturn(['assignee-details']);
     $repoFactory->create($pullRequestPayload)->willReturn($repoValueObject);
     $pullRequestFactory->create($pullRequestPayload)->willReturn($pullRequestValueObject);
     $commitFactory->create($pullRequestPayload)->willReturn($commitValueObject);
     $pullRequestCreatorFactory->create($pullRequestPayload)->willReturn($pullRequestCreatorValueObject);
     $pullRequestAssigneeFactory->create($pullRequestPayload)->willReturn($pullRequestAssigneeValueObject);
     $githubRepoFacade->getOrCreate($repoValueObject)->willReturn($githubRepoEntity);
     $githubPullRequestFacade->getOrCreate($githubRepoEntity, $pullRequestValueObject)->willReturn($githubPullRequestEntity);
     $githubCommitFacade->getOrCreate($githubRepoEntity, $commitValueObject)->willReturn($githubCommitEntity);
     $githubUserFacade->getOrCreate($pullRequestCreatorValueObject)->willReturn($githubPullRequestCreatorEntity);
     $githubUserFacade->getOrCreate($pullRequestAssigneeValueObject)->willReturn($githubPullRequestAssigneeEntity);
     $githubPullRequestEntity->setCreatedBy($githubPullRequestCreatorEntity)->shouldBeCalled();
     $githubPullRequestEntity->setAssignedTo($githubPullRequestAssigneeEntity)->shouldBeCalled();
     $githubPullRequestEntity->setLastCommit($githubCommitEntity)->shouldBeCalled();
     $githubPullRequestEntity->setState(GithubPullRequestState::OPENED)->shouldBeCalled();
     $pullRequestValueObject->getState()->willReturn('open');
     $em->persist($githubPullRequestEntity)->shouldBeCalled();
     $em->persist($githubCommitEntity)->shouldBeCalled();
     $em->flush()->shouldBeCalled();
     $this->process($pullRequestPayload)->shouldReturn(true);
 }
Example #5
0
 public function it_will_create_remote_repo_value_object(PullRequestPayload $pullRequestPayload)
 {
     $data = ['id' => 'githubId', 'name' => 'name', 'full_name' => 'owner/name', 'owner' => ['login' => 'owner'], 'html_url' => 'https://github.com/owner/name', 'description' => 'Description', 'fork' => false, 'default_branch' => 'master', 'private' => false, 'git_url' => 'git://github.com/owner/name.git', 'ssh_url' => 'git@github.com:owner/name.git', 'created_at' => '2015-10-17T15:53:45Z', 'updated_at' => '2015-10-17T15:53:45Z', 'pushed_at' => '2015-10-17T15:53:45Z'];
     $pullRequestPayload->getRepositoryDetails()->willReturn($data);
     $this->create($pullRequestPayload)->shouldReturnAnInstanceOf('DevBoard\\GithubRemote\\ValueObject\\Repo\\Repo');
 }
 /**
  * @param PullRequestPayload $pullRequestPayload
  *
  * @return CommitAuthor
  */
 public function create(PullRequestPayload $pullRequestPayload)
 {
     $data = $pullRequestPayload->getPullRequestCreatorDetails();
     return new PullRequestCreator($data['id'], $data['login'], $data['avatar_url']);
 }
Example #7
0
 /**
  * @param PullRequestPayload $pullRequestPayload
  *
  * @return PullRequest
  */
 public function create(PullRequestPayload $pullRequestPayload)
 {
     $data = $pullRequestPayload->getPullRequestDetails();
     return new PullRequest($data['number'], $data['title'], $data['body'], $data['state'], $data['locked'], $data['merged'], new DateTime($data['created_at']), new DateTime($data['updated_at']));
 }
Example #8
0
 /**
  * @param PullRequestPayload $pullRequestPayload
  *
  * @return Repo
  */
 public function create(PullRequestPayload $pullRequestPayload)
 {
     $data = $pullRequestPayload->getRepositoryDetails();
     return new Repo($data['id'], $data['owner']['login'], $data['name'], $data['full_name'], $data['html_url'], $data['description'], $data['fork'], $data['default_branch'], $data['private'], $data['git_url'], $data['ssh_url'], new DateTime($data['created_at']), new DateTime($data['updated_at']), new DateTime($data['pushed_at']));
 }
Example #9
0
 /**
  * @param PullRequestPayload $pullRequestPayload
  *
  * @return Commit
  */
 public function create(PullRequestPayload $pullRequestPayload)
 {
     $data = $pullRequestPayload->getHeadCommitDetails();
     return new Commit($data['sha'], new DateTime(), new DateTime(), 'Unknown, PR doesnt send commit details');
 }