Example #1
0
 public function it_will_create_remote_commit_value_object(GithubBranchData $githubBranchData)
 {
     $data = ['sha' => 'sha', 'commit' => ['author' => ['date' => '2015-08-21T19:25:38Z'], 'committer' => ['date' => '2015-08-21T19:25:38Z'], 'message' => 'Message']];
     $githubBranchData->getCommitData()->willReturn($data);
     $result = $this->create($githubBranchData);
     $result->shouldReturnAnInstanceOf('DevBoard\\GithubRemote\\ValueObject\\Commit\\Commit');
     $result->getSha()->shouldReturn('sha');
     $result->getMessage()->shouldReturn('Message');
 }
 public function it_will_create_remote_commit_committer_value_object(GithubBranchData $githubBranchData)
 {
     $data = ['commit' => ['author' => ['name' => 'author1', 'email' => '*****@*****.**', 'date' => '2015-08-21T19:25:38Z'], 'committer' => ['name' => 'author1', 'email' => '*****@*****.**', 'date' => '2015-08-21T19:25:38Z']], 'author' => ['login' => 'author1', 'id' => 123, 'avatar_url' => 'https://avatars.githubusercontent.com/u/123?v=3'], 'committer' => ['login' => 'author1', 'id' => 123, 'avatar_url' => 'https://avatars.githubusercontent.com/u/123?v=3']];
     $githubBranchData->getCommitData()->willReturn($data);
     $result = $this->create($githubBranchData);
     $result->shouldReturnAnInstanceOf('DevBoard\\GithubRemote\\ValueObject\\User\\CommitCommitter');
     $result->getName()->shouldReturn('author1');
     $result->getEmail()->shouldReturn('*****@*****.**');
     $result->getUsername()->shouldReturn('author1');
 }
Example #3
0
 /**
  * @param PushPayload|GithubBranchData $githubBranchData
  *
  * @return Commit
  */
 public function create(GithubBranchData $githubBranchData)
 {
     $data = $githubBranchData->getCommitData();
     return new Commit($data['sha'], new DateTime($data['commit']['author']['date']), new DateTime($data['commit']['committer']['date']), $data['commit']['message']);
 }
 /**
  * @param PushPayload|GithubBranchData $githubBranchData
  *
  * @return CommitCommitter
  */
 public function create(GithubBranchData $githubBranchData)
 {
     $data = $githubBranchData->getCommitData();
     return new CommitCommitter($data['commit']['committer']['name'], $data['commit']['committer']['email'], $data['committer']['login']);
 }