10e62c4b8SGreg Roach<?php 20e62c4b8SGreg Roach/** 30e62c4b8SGreg Roach * webtrees: online genealogy 48fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team 50e62c4b8SGreg Roach * This program is free software: you can redistribute it and/or modify 60e62c4b8SGreg Roach * it under the terms of the GNU General Public License as published by 70e62c4b8SGreg Roach * the Free Software Foundation, either version 3 of the License, or 80e62c4b8SGreg Roach * (at your option) any later version. 90e62c4b8SGreg Roach * This program is distributed in the hope that it will be useful, 100e62c4b8SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 110e62c4b8SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 120e62c4b8SGreg Roach * GNU General Public License for more details. 130e62c4b8SGreg Roach * You should have received a copy of the GNU General Public License 140e62c4b8SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 150e62c4b8SGreg Roach */ 16e7f56f2aSGreg Roachdeclare(strict_types=1); 17e7f56f2aSGreg Roach 1884e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\Module; 190e62c4b8SGreg Roach 209a3accd7SGreg Roachuse Fisharebest\Webtrees\Report\ReportHtml; 219a3accd7SGreg Roachuse Fisharebest\Webtrees\Report\ReportParserGenerate; 229a3accd7SGreg Roachuse Fisharebest\Webtrees\Report\ReportPdf; 239a3accd7SGreg Roachuse Fisharebest\Webtrees\Tree; 249a3accd7SGreg Roach 250e62c4b8SGreg Roach/** 260e62c4b8SGreg Roach * Test harness for the class BirthDeathMarriageReportModule 279a3accd7SGreg Roach * 289a3accd7SGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtml 29*c52e6333SGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate 30*c52e6333SGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdf 310e62c4b8SGreg Roach */ 3284e2cf4eSGreg Roachclass BirthDeathMarriageReportModuleTest extends \Fisharebest\Webtrees\TestCase 33c1010edaSGreg Roach{ 349a3accd7SGreg Roach protected static $uses_database = true; 359a3accd7SGreg Roach 360e62c4b8SGreg Roach /** 3752348eb8SGreg Roach * @return void 380e62c4b8SGreg Roach */ 399a3accd7SGreg Roach public function testReportRunsWithoutError(): void 40c1010edaSGreg Roach { 419a3accd7SGreg Roach $tree = $this->importTree('demo.ged'); 429a3accd7SGreg Roach app()->instance(Tree::class, $tree); 439a3accd7SGreg Roach $xml = WT_ROOT . 'resources/xml/reports/bdm_report.xml'; 449a3accd7SGreg Roach $vars = [ 459a3accd7SGreg Roach 'name' => ['id' => ''], 469a3accd7SGreg Roach 'bdmplace' => ['id' => ''], 479a3accd7SGreg Roach 'birthdate1' => ['id' => ''], 489a3accd7SGreg Roach 'birthdate2' => ['id' => ''], 499a3accd7SGreg Roach 'deathdate1' => ['id' => ''], 509a3accd7SGreg Roach 'deathdate2' => ['id' => ''], 519a3accd7SGreg Roach 'sortby' => ['id' => 'BIRT:DATE'], 529a3accd7SGreg Roach 'pageSize' => ['id' => 'A4'], 539a3accd7SGreg Roach ]; 549a3accd7SGreg Roach 559a3accd7SGreg Roach ob_start(); 569a3accd7SGreg Roach new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree); 579a3accd7SGreg Roach $html = ob_get_clean(); 589a3accd7SGreg Roach $this->assertStringStartsWith('<', $html); 599a3accd7SGreg Roach $this->assertStringEndsWith('>', $html); 609a3accd7SGreg Roach 619a3accd7SGreg Roach ob_start(); 629a3accd7SGreg Roach new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree); 639a3accd7SGreg Roach $pdf = ob_get_clean(); 649a3accd7SGreg Roach $this->assertStringStartsWith('%PDF', $pdf); 659a3accd7SGreg Roach $this->assertStringEndsWith("%%EOF\n", $pdf); 660e62c4b8SGreg Roach } 670e62c4b8SGreg Roach} 68