13763c3f2SGreg Roach<?php 23976b470SGreg Roach 33763c3f2SGreg Roach/** 43763c3f2SGreg Roach * webtrees: online genealogy 5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 63763c3f2SGreg Roach * This program is free software: you can redistribute it and/or modify 73763c3f2SGreg Roach * it under the terms of the GNU General Public License as published by 83763c3f2SGreg Roach * the Free Software Foundation, either version 3 of the License, or 93763c3f2SGreg Roach * (at your option) any later version. 103763c3f2SGreg Roach * This program is distributed in the hope that it will be useful, 113763c3f2SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 123763c3f2SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 133763c3f2SGreg Roach * GNU General Public License for more details. 143763c3f2SGreg 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/>. 163763c3f2SGreg Roach */ 17fcfa147eSGreg Roach 18e7f56f2aSGreg Roachdeclare(strict_types=1); 19e7f56f2aSGreg Roach 2084e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\Module; 213763c3f2SGreg Roach 223c5bb98bSGreg Roachuse Fisharebest\Webtrees\Auth; 231fe542e9SGreg Roachuse Fisharebest\Webtrees\Contracts\UserInterface; 24b6f35a76SGreg Roachuse Fisharebest\Webtrees\Report\HtmlRenderer; 25f0c88a96SGreg Roachuse Fisharebest\Webtrees\Report\PdfRenderer; 269a3accd7SGreg Roachuse Fisharebest\Webtrees\Report\ReportParserGenerate; 274358d8aeSGreg Roachuse Fisharebest\Webtrees\Report\ReportParserSetup; 283c5bb98bSGreg Roachuse Fisharebest\Webtrees\Services\UserService; 293cfcc809SGreg Roachuse Fisharebest\Webtrees\TestCase; 309a3accd7SGreg Roach 313763c3f2SGreg Roach/** 323763c3f2SGreg Roach * Test harness for the class MissingFactsReportModule 33824da64cSGreg Roach */ 34824da64cSGreg Roachclass MissingFactsReportModuleTest extends TestCase 35824da64cSGreg Roach{ 36cd94ca66SGreg Roach protected static bool $uses_database = true; 37824da64cSGreg Roach 38824da64cSGreg Roach /** 396113edefSGreg Roach * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait 40824da64cSGreg Roach * @covers \Fisharebest\Webtrees\Module\PedigreeReportModule 41b6f35a76SGreg Roach * @covers \Fisharebest\Webtrees\Report\AbstractRenderer 42824da64cSGreg Roach * @covers \Fisharebest\Webtrees\Report\HtmlRenderer 43824da64cSGreg Roach * @covers \Fisharebest\Webtrees\Report\PdfRenderer 446113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseCell 456113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseElement 466113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote 476113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseImage 486113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseLine 496113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseText 506113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox 516113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider 526113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell 536113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote 546113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage 556113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine 566113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlText 576113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox 586113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportParserBase 59c52e6333SGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate 606113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportParserSetup 616113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfCell 626113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote 636113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfImage 646113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfLine 656113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfText 66b6f35a76SGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfTextBox 67824da64cSGreg Roach * @covers \Fisharebest\Webtrees\Report\TcpdfWrapper 683763c3f2SGreg Roach */ 699a3accd7SGreg Roach public function testReportRunsWithoutError(): void 70c1010edaSGreg Roach { 713c5bb98bSGreg Roach $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); 721fe542e9SGreg Roach $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); 733c5bb98bSGreg Roach Auth::login($user); 743c5bb98bSGreg Roach 759a3accd7SGreg Roach $tree = $this->importTree('demo.ged'); 760acf1b4bSGreg Roach $module = new MissingFactsReportModule(); 770acf1b4bSGreg Roach $module->setName('missing_facts_report'); 780acf1b4bSGreg Roach 79824da64cSGreg Roach $xml = 'resources/' . $module->xmlFilename(); 809a3accd7SGreg Roach $vars = [ 813c5bb98bSGreg Roach 'pid' => ['id' => 'X1030'], 829a3accd7SGreg Roach 'relatives' => ['id' => 'direct-ancestors'], 839a3accd7SGreg Roach 'maxgen' => ['id' => '*'], 849a3accd7SGreg Roach 'pageSize' => ['id' => 'A4'], 859a3accd7SGreg Roach 'sortby' => ['id' => 'NAME'], 869a3accd7SGreg Roach 'fbirt' => ['id' => 'on'], 873c5bb98bSGreg Roach 'fburi' => ['id' => 'on'], 889a3accd7SGreg Roach 'fdeat' => ['id' => 'on'], 899a3accd7SGreg Roach 'fsour' => ['id' => 'on'], 909a3accd7SGreg Roach 'fbapm' => ['id' => 'on'], 919a3accd7SGreg Roach 'fbarm' => ['id' => 'on'], 929a3accd7SGreg Roach 'fbasm' => ['id' => 'on'], 939a3accd7SGreg Roach 'fconf' => ['id' => 'on'], 949a3accd7SGreg Roach 'fenga' => ['id' => 'on'], 959a3accd7SGreg Roach 'ffcom' => ['id' => 'on'], 969a3accd7SGreg Roach 'fmarb' => ['id' => 'on'], 979a3accd7SGreg Roach 'fmarr' => ['id' => 'on'], 989a3accd7SGreg Roach 'freli' => ['id' => 'on'], 999a3accd7SGreg Roach ]; 1009a3accd7SGreg Roach 1014358d8aeSGreg Roach $report = new ReportParserSetup($xml); 102*58a588c6SGreg Roach self::assertNotEmpty($report->reportProperties()); 1034358d8aeSGreg Roach 1049a3accd7SGreg Roach ob_start(); 1059458f20aSGreg Roach new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree); 1069a3accd7SGreg Roach $html = ob_get_clean(); 1075e933c21SGreg Roach self::assertStringStartsWith('<', $html); 1085e933c21SGreg Roach self::assertStringEndsWith('>', $html); 1099a3accd7SGreg Roach 1109a3accd7SGreg Roach ob_start(); 1119458f20aSGreg Roach new ReportParserGenerate($xml, new PdfRenderer(), $vars, $tree); 1129a3accd7SGreg Roach $pdf = ob_get_clean(); 1135e933c21SGreg Roach self::assertStringStartsWith('%PDF', $pdf); 1145e933c21SGreg Roach self::assertStringEndsWith("%%EOF\n", $pdf); 1153763c3f2SGreg Roach } 1163763c3f2SGreg Roach} 117