Beispiel #1
0
 public function testConstructorSetsValues()
 {
     $message = new Message('Test', '/path/to/file', 321);
     $this->assertEquals('Test', $message->getBody());
     $this->assertEquals('/path/to/file', $message->getPath());
     $this->assertEquals(321, $message->getPosition());
 }
Beispiel #2
0
 /**
  * @param Message $message
  * @return string
  */
 protected function generateSummaryOfMessage(Message $message)
 {
     $commit = $message->getCommit();
     $pullRequest = $message->getPullRequest();
     $preamble = '';
     if (TRUE === $commit instanceof Commit) {
         $preamble = 'Commit: ' . $commit->getId();
         $path = $message->getPath();
         if (NULL !== $path) {
             $preamble .= PHP_EOL;
             $preamble .= 'File: ' . $path . PHP_EOL;
             $preamble .= 'Line: ' . $message->getPosition();
         }
     } elseif (TRUE === $pullRequest instanceof PullRequest) {
         $preamble = 'Pull Request: ' . $pullRequest->getId();
     }
     $summary = $preamble . PHP_EOL . $message->getBody();
     return $summary;
 }