예제 #1
0
 /**
  * @return array
  */
 public function getToGitHubApiDataArrayTestValues()
 {
     $commit = new Commit();
     $commit->setId(321);
     $pullRequest = new PullRequest();
     $pullRequest->setId(456);
     $withCommit = new Message('Message');
     $withCommit->setCommit($commit);
     $withCommitAndPath = new Message('Message', '/path/to/file', 123);
     $withCommitAndPath->setCommit($commit);
     $withPullRequest = new Message('Message');
     $withPullRequest->setPullRequest($pullRequest);
     return array(array(new Message('Message'), array('body' => 'Message')), array(new Message('Message', '/path/to/file', 123), array('body' => 'Message')), array($withCommit, array('body' => 'Message')), array($withCommitAndPath, array('body' => 'Message', 'path' => '/path/to/file', 'position' => 123, 'commit_id' => 321)), array($withPullRequest, array('body' => 'Message', 'sha1' => 456)));
 }
예제 #2
0
 /**
  * @param Message $message
  */
 public function sendMessage(Message $message)
 {
     $lacksCommitAndPullRequest = NULL === $message->getCommit() && NULL === $message->getPullRequest();
     $pullRequest = $this->getPullRequest();
     $head = $this->getHead();
     if (TRUE === $lacksCommitAndPullRequest && $pullRequest instanceof PullRequest) {
         $message->setPullRequest($pullRequest);
     } elseif (TRUE === $lacksCommitAndPullRequest && TRUE === $head instanceof Commit) {
         $message->setCommit($head);
     }
     $id = spl_object_hash($message);
     $this->messages[$id] = $message;
 }
예제 #3
0
 /**
  * @return array
  */
 public function getGenerateSummaryOfMessageTestValues()
 {
     $pullRequest = new PullRequest();
     $pullRequest->setId('123');
     $withPullRequest = new Message('Test message with pull request');
     $withPullRequest->setPullRequest($pullRequest);
     $commit = new Commit();
     $commit->setId('456');
     $withCommit = new Message('Test message with commit');
     $withCommit->setCommit($commit);
     $withCommitAndPath = clone $withCommit;
     $withCommitAndPath->setPath('/path/to/file');
     $withCommitAndPath->setPosition(789);
     return array(array($withPullRequest, 'Pull Request: 123' . PHP_EOL . 'Test message with pull request'), array($withCommit, 'Commit: 456' . PHP_EOL . 'Test message with commit'), array($withCommitAndPath, 'Commit: 456' . PHP_EOL . 'File: /path/to/file' . PHP_EOL . 'Line: 789' . PHP_EOL . 'Test message with commit'));
 }