10e62c4b8SGreg Roach<?php 23976b470SGreg Roach 30e62c4b8SGreg Roach/** 40e62c4b8SGreg Roach * webtrees: online genealogy 5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 60e62c4b8SGreg Roach * This program is free software: you can redistribute it and/or modify 70e62c4b8SGreg Roach * it under the terms of the GNU General Public License as published by 80e62c4b8SGreg Roach * the Free Software Foundation, either version 3 of the License, or 90e62c4b8SGreg Roach * (at your option) any later version. 100e62c4b8SGreg Roach * This program is distributed in the hope that it will be useful, 110e62c4b8SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 120e62c4b8SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 130e62c4b8SGreg Roach * GNU General Public License for more details. 140e62c4b8SGreg Roach * You should have received a copy of the GNU General Public License 1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 160e62c4b8SGreg Roach */ 17fcfa147eSGreg Roach 18e7f56f2aSGreg Roachdeclare(strict_types=1); 19e7f56f2aSGreg Roach 2084e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\Module; 210e62c4b8SGreg Roach 22202c018bSGreg Roachuse Fisharebest\Webtrees\Report\AbstractRenderer; 23b6f35a76SGreg Roachuse Fisharebest\Webtrees\Report\HtmlRenderer; 24f0c88a96SGreg Roachuse Fisharebest\Webtrees\Report\PdfRenderer; 25202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportBaseCell; 26202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportBaseElement; 27202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportBaseFootnote; 28202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportBaseImage; 29202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportBaseLine; 30202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportBaseText; 31202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportBaseTextbox; 32202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider; 33202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportHtmlCell; 34202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportHtmlFootnote; 35202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportHtmlImage; 36202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportHtmlLine; 37202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportHtmlText; 38202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportHtmlTextbox; 39202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportParserBase; 409a3accd7SGreg Roachuse Fisharebest\Webtrees\Report\ReportParserGenerate; 414358d8aeSGreg Roachuse Fisharebest\Webtrees\Report\ReportParserSetup; 42202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportPdfCell; 43202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportPdfFootnote; 44202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportPdfImage; 45202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportPdfLine; 46202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportPdfText; 47202c018bSGreg Roachuse Fisharebest\Webtrees\Report\ReportPdfTextBox; 48202c018bSGreg Roachuse Fisharebest\Webtrees\Report\TcpdfWrapper; 493cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase; 50202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass; 51a6305e60SGreg Roachuse PHPUnit\Framework\Attributes\CoversTrait; 529a3accd7SGreg Roach 53168400f2SJulien BARBEY#[CoversTrait(ModuleReportTrait::class)] 54202c018bSGreg Roach#[CoversClass(PedigreeReportModule::class)] 55202c018bSGreg Roach#[CoversClass(AbstractRenderer::class)] 56202c018bSGreg Roach#[CoversClass(HtmlRenderer::class)] 57202c018bSGreg Roach#[CoversClass(PdfRenderer::class)] 58202c018bSGreg Roach#[CoversClass(ReportBaseCell::class)] 59202c018bSGreg Roach#[CoversClass(ReportBaseElement::class)] 60202c018bSGreg Roach#[CoversClass(ReportBaseFootnote::class)] 61202c018bSGreg Roach#[CoversClass(ReportBaseImage::class)] 62202c018bSGreg Roach#[CoversClass(ReportBaseLine::class)] 63202c018bSGreg Roach#[CoversClass(ReportBaseText::class)] 64202c018bSGreg Roach#[CoversClass(ReportBaseTextbox::class)] 65202c018bSGreg Roach#[CoversClass(ReportExpressionLanguageProvider::class)] 66202c018bSGreg Roach#[CoversClass(ReportHtmlCell::class)] 67202c018bSGreg Roach#[CoversClass(ReportHtmlFootnote::class)] 68202c018bSGreg Roach#[CoversClass(ReportHtmlImage::class)] 69202c018bSGreg Roach#[CoversClass(ReportHtmlLine::class)] 70202c018bSGreg Roach#[CoversClass(ReportHtmlText::class)] 71202c018bSGreg Roach#[CoversClass(ReportHtmlTextbox::class)] 72202c018bSGreg Roach#[CoversClass(ReportParserBase::class)] 73202c018bSGreg Roach#[CoversClass(ReportParserGenerate::class)] 74202c018bSGreg Roach#[CoversClass(ReportParserSetup::class)] 75202c018bSGreg Roach#[CoversClass(ReportPdfCell::class)] 76202c018bSGreg Roach#[CoversClass(ReportPdfFootnote::class)] 77202c018bSGreg Roach#[CoversClass(ReportPdfImage::class)] 78202c018bSGreg Roach#[CoversClass(ReportPdfLine::class)] 79202c018bSGreg Roach#[CoversClass(ReportPdfText::class)] 80202c018bSGreg Roach#[CoversClass(ReportPdfTextBox::class)] 81202c018bSGreg Roach#[CoversClass(TcpdfWrapper::class)] 82824da64cSGreg Roachclass BirthDeathMarriageReportModuleTest extends TestCase 83824da64cSGreg Roach{ 84cd94ca66SGreg Roach protected static bool $uses_database = true; 85824da64cSGreg Roach 869a3accd7SGreg Roach public function testReportRunsWithoutError(): void 87c1010edaSGreg Roach { 889a3accd7SGreg Roach $tree = $this->importTree('demo.ged'); 890acf1b4bSGreg Roach $module = new BirthDeathMarriageReportModule(); 900acf1b4bSGreg Roach $module->setName('bdm_report'); 910acf1b4bSGreg Roach 92824da64cSGreg Roach $xml = 'resources/' . $module->xmlFilename(); 939a3accd7SGreg Roach $vars = [ 949a3accd7SGreg Roach 'name' => ['id' => ''], 959a3accd7SGreg Roach 'bdmplace' => ['id' => ''], 969a3accd7SGreg Roach 'birthdate1' => ['id' => ''], 979a3accd7SGreg Roach 'birthdate2' => ['id' => ''], 989a3accd7SGreg Roach 'deathdate1' => ['id' => ''], 999a3accd7SGreg Roach 'deathdate2' => ['id' => ''], 1009a3accd7SGreg Roach 'sortby' => ['id' => 'BIRT:DATE'], 1019a3accd7SGreg Roach 'pageSize' => ['id' => 'A4'], 1029a3accd7SGreg Roach ]; 1039a3accd7SGreg Roach 104*73f6d2b5SGreg Roach new ReportParserSetup($xml); 1054358d8aeSGreg Roach 1069a3accd7SGreg Roach ob_start(); 1079458f20aSGreg Roach new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree); 1089a3accd7SGreg Roach $html = ob_get_clean(); 109*73f6d2b5SGreg Roach self::assertIsString($html); 1105e933c21SGreg Roach self::assertStringStartsWith('<', $html); 1115e933c21SGreg Roach self::assertStringEndsWith('>', $html); 1129a3accd7SGreg Roach 1139a3accd7SGreg Roach ob_start(); 1149458f20aSGreg Roach new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree); 1159a3accd7SGreg Roach $pdf = ob_get_clean(); 116*73f6d2b5SGreg Roach self::assertIsString($pdf); 1175e933c21SGreg Roach self::assertStringStartsWith('%PDF', $pdf); 1185e933c21SGreg Roach self::assertStringEndsWith("%%EOF\n", $pdf); 1190e62c4b8SGreg Roach } 1200e62c4b8SGreg Roach} 121