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 * 28*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Module\BirthDeathMarriageReportModule 29*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait 30*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\AbstractReport 31*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseCell 32*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseElement 33*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote 34*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml 35*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseImage 36*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseLine 37*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader 38*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseText 39*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox 40*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider 419a3accd7SGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtml 42*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell 43*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote 44*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml 45*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage 46*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine 47*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader 48*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlText 49*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox 50*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportParserBase 51c52e6333SGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate 52*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportParserSetup 53c52e6333SGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdf 54*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfCell 55*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote 56*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml 57*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfImage 58*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfLine 59*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader 60*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfText 61*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox 62*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportTcpdf 630e62c4b8SGreg Roach */ 6484e2cf4eSGreg Roachclass BirthDeathMarriageReportModuleTest extends \Fisharebest\Webtrees\TestCase 65c1010edaSGreg Roach{ 669a3accd7SGreg Roach protected static $uses_database = true; 679a3accd7SGreg Roach 680e62c4b8SGreg Roach /** 6952348eb8SGreg Roach * @return void 700e62c4b8SGreg Roach */ 719a3accd7SGreg Roach public function testReportRunsWithoutError(): void 72c1010edaSGreg Roach { 739a3accd7SGreg Roach $tree = $this->importTree('demo.ged'); 749a3accd7SGreg Roach app()->instance(Tree::class, $tree); 759a3accd7SGreg Roach $xml = WT_ROOT . 'resources/xml/reports/bdm_report.xml'; 769a3accd7SGreg Roach $vars = [ 779a3accd7SGreg Roach 'name' => ['id' => ''], 789a3accd7SGreg Roach 'bdmplace' => ['id' => ''], 799a3accd7SGreg Roach 'birthdate1' => ['id' => ''], 809a3accd7SGreg Roach 'birthdate2' => ['id' => ''], 819a3accd7SGreg Roach 'deathdate1' => ['id' => ''], 829a3accd7SGreg Roach 'deathdate2' => ['id' => ''], 839a3accd7SGreg Roach 'sortby' => ['id' => 'BIRT:DATE'], 849a3accd7SGreg Roach 'pageSize' => ['id' => 'A4'], 859a3accd7SGreg Roach ]; 869a3accd7SGreg Roach 879a3accd7SGreg Roach ob_start(); 889a3accd7SGreg Roach new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree); 899a3accd7SGreg Roach $html = ob_get_clean(); 909a3accd7SGreg Roach $this->assertStringStartsWith('<', $html); 919a3accd7SGreg Roach $this->assertStringEndsWith('>', $html); 929a3accd7SGreg Roach 939a3accd7SGreg Roach ob_start(); 949a3accd7SGreg Roach new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree); 959a3accd7SGreg Roach $pdf = ob_get_clean(); 969a3accd7SGreg Roach $this->assertStringStartsWith('%PDF', $pdf); 979a3accd7SGreg Roach $this->assertStringEndsWith("%%EOF\n", $pdf); 980e62c4b8SGreg Roach } 990e62c4b8SGreg Roach} 100