/** * @return Release[] */ public function getReleases() { if (empty($this->releases)) { $headings = preg_grep('/^## (\\[?)([^\\s\\[\\]#]*)(\\]?)( - ([0-9]{4}-[0-9]{2}-[0-9]{2}))?$/', $this->content); while ($current_heading = current($headings)) { $start = key($headings); next($headings); $end = key($headings) - 1; $release_content = array_slice($this->content, $start, $end); $release = new Release($release_content); $this->releases[$release->getVersion()] = new Release($release_content); } } return $this->releases; }
/** * @dataProvider providerFiles */ public function testXml($filename) { $data = $this->loadContent($filename . '.md'); $release = new Release($data); $this->assertXmlStringEqualsXmlFile(__DIR__ . '/data/' . $filename . '.xml', $release->toXml()); }