function testMultipleLink()
 {
     $message = new CommitMessage("Hello\nworld\n");
     $message->addLinkNote('http://example.com', 'Example');
     $message->addLinkNote('http://example.org', 'Example For Good');
     $message->addLinkNote('http://example.com', 'Example Redundant');
     $this->assertEquals("Hello\nworld\n\n----------------------------------------\n* Example\n  http://example.com\n* Example For Good\n  http://example.org\n", $message->toString());
 }
 public function filterWord(CommitMessage $message, $word)
 {
     if (preg_match($this->wordPattern, $word)) {
         $issue = $this->getIssue($word);
         if ($issue) {
             $title = $word . ': ' . $issue->getSummary();
         } else {
             $title = $word . ':';
         }
         $message->addLinkNote($this->url . '/browse/' . $word, $title);
     }
     return $word;
 }
예제 #3
0
 /**
  * Filter each word in the commit message separately.
  *
  * @param CommitMessage $message
  * @param $word
  * @return mixed
  */
 public function filterWord(CommitMessage $message, $word)
 {
     if ($this->isIssueKey($word)) {
         $issue = $this->getIssue($word);
         if ($issue) {
             $title = $word . ': ' . $issue->getSummary();
         } else {
             $title = $word . ':';
         }
         $url = $this->createIssueUrl($word);
         // CRM-13872 - Workaround to avoid duplicate footnotes when amending a commit message
         if (strpos($message->getMessage(), $url) === FALSE) {
             $message->addLinkNote($url, $title);
         }
     }
     return $word;
 }