Exemplo n.º 1
0
 public function testGetCommitsFromVersion()
 {
     $file = __DIR__ . '/changelog.xml';
     $changelog = new Changelog($file);
     $versions = $changelog->getVersions();
     $version1 = $versions->item(0);
     $commits = Changelog::getCommitsFromVersion($version1);
     $this->assertInternalType('array', $commits);
     $this->assertNotEmpty($commits);
     $this->assertArrayHasKey('abcdef', $commits);
     $this->assertContains('Fixed something', $commits);
 }
Exemplo n.º 2
0
 public function render($file = "CHANGELOG.md")
 {
     $buffer = '# Changelog' . PHP_EOL;
     $versions = $this->changelog->getVersions();
     foreach ($versions as $version) {
         $versionNumber = Changelog::getVersionNumberFromVersion($version);
         $title = Changelog::getTitleFromVersion($version);
         $buffer .= PHP_EOL . '## ' . $versionNumber . ' - ' . $title . PHP_EOL . PHP_EOL;
         $commits = Changelog::getCommitsFromVersion($version);
         foreach ($commits as $hash => $message) {
             $buffer .= '* ' . $message . " [{$hash}]" . PHP_EOL;
         }
     }
     file_put_contents($file, $buffer);
 }