xref: /webtrees/tests/app/Module/MissingFactsReportModuleTest.php (revision 6113edef98ca0d6ccd32d87c5ef69dbe3ec83127)
13763c3f2SGreg Roach<?php
23763c3f2SGreg Roach/**
33763c3f2SGreg Roach * webtrees: online genealogy
48fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
53763c3f2SGreg Roach * This program is free software: you can redistribute it and/or modify
63763c3f2SGreg Roach * it under the terms of the GNU General Public License as published by
73763c3f2SGreg Roach * the Free Software Foundation, either version 3 of the License, or
83763c3f2SGreg Roach * (at your option) any later version.
93763c3f2SGreg Roach * This program is distributed in the hope that it will be useful,
103763c3f2SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
113763c3f2SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
123763c3f2SGreg Roach * GNU General Public License for more details.
133763c3f2SGreg Roach * You should have received a copy of the GNU General Public License
143763c3f2SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
153763c3f2SGreg Roach */
16e7f56f2aSGreg Roachdeclare(strict_types=1);
17e7f56f2aSGreg Roach
1884e2cf4eSGreg Roachnamespace Fisharebest\Webtrees\Module;
193763c3f2SGreg 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
253763c3f2SGreg Roach/**
263763c3f2SGreg Roach * Test harness for the class MissingFactsReportModule
279a3accd7SGreg Roach *
28*6113edefSGreg Roach * @covers \Fisharebest\Webtrees\Module\MissingFactsReportModule
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
633763c3f2SGreg Roach */
6484e2cf4eSGreg Roachclass MissingFactsReportModuleTest extends \Fisharebest\Webtrees\TestCase
65c1010edaSGreg Roach{
669a3accd7SGreg Roach    protected static $uses_database = true;
679a3accd7SGreg Roach
683763c3f2SGreg Roach    /**
6952348eb8SGreg Roach     * @return void
703763c3f2SGreg 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/missing_facts_report.xml';
769a3accd7SGreg Roach        $vars = [
779a3accd7SGreg Roach            'pid'       => ['id' => 'i1'],
789a3accd7SGreg Roach            'relatives' => ['id' => 'direct-ancestors'],
799a3accd7SGreg Roach            'maxgen'    => ['id' => '*'],
809a3accd7SGreg Roach            'pageSize'  => ['id' => 'A4'],
819a3accd7SGreg Roach            'sortby'    => ['id' => 'NAME'],
829a3accd7SGreg Roach            'fbirt'     => ['id' => 'on'],
839a3accd7SGreg Roach            'fdeat'     => ['id' => 'on'],
849a3accd7SGreg Roach            'fsour'     => ['id' => 'on'],
859a3accd7SGreg Roach            'fbapm'     => ['id' => 'on'],
869a3accd7SGreg Roach            'fbarm'     => ['id' => 'on'],
879a3accd7SGreg Roach            'fbasm'     => ['id' => 'on'],
889a3accd7SGreg Roach            'fconf'     => ['id' => 'on'],
899a3accd7SGreg Roach            'fenga'     => ['id' => 'on'],
909a3accd7SGreg Roach            'ffcom'     => ['id' => 'on'],
919a3accd7SGreg Roach            'fmarb'     => ['id' => 'on'],
929a3accd7SGreg Roach            'fmarr'     => ['id' => 'on'],
939a3accd7SGreg Roach            'freli'     => ['id' => 'on'],
949a3accd7SGreg Roach        ];
959a3accd7SGreg Roach
969a3accd7SGreg Roach        ob_start();
979a3accd7SGreg Roach        new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
989a3accd7SGreg Roach        $html = ob_get_clean();
999a3accd7SGreg Roach        $this->assertStringStartsWith('<', $html);
1009a3accd7SGreg Roach        $this->assertStringEndsWith('>', $html);
1019a3accd7SGreg Roach
1029a3accd7SGreg Roach        ob_start();
1039a3accd7SGreg Roach        new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
1049a3accd7SGreg Roach        $pdf = ob_get_clean();
1059a3accd7SGreg Roach        $this->assertStringStartsWith('%PDF', $pdf);
1069a3accd7SGreg Roach        $this->assertStringEndsWith("%%EOF\n", $pdf);
1073763c3f2SGreg Roach    }
1083763c3f2SGreg Roach}
109