xref: /webtrees/tests/app/Module/BirthDeathMarriageReportModuleTest.php (revision f397d0fdeebb0d5a9590d5ba2d4d2aae8df09df1)
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;
24*f397d0fdSGreg Roachuse Fisharebest\Webtrees\Webtrees;
259a3accd7SGreg Roach
260e62c4b8SGreg Roach/**
270e62c4b8SGreg Roach * Test harness for the class BirthDeathMarriageReportModule
289a3accd7SGreg Roach *
296113edefSGreg Roach * @covers \Fisharebest\Webtrees\Module\BirthDeathMarriageReportModule
306113edefSGreg Roach * @covers \Fisharebest\Webtrees\Module\ModuleReportTrait
316113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\AbstractReport
326113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseCell
336113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseElement
346113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseFootnote
356113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseHtml
366113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseImage
376113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseLine
386113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBasePageheader
396113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseText
406113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportBaseTextbox
416113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportExpressionLanguageProvider
429a3accd7SGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtml
436113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlCell
446113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlFootnote
456113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlHtml
466113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlImage
476113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlLine
486113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlPageheader
496113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlText
506113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportHtmlTextbox
516113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportParserBase
52c52e6333SGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate
536113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportParserSetup
54c52e6333SGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdf
556113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfCell
566113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfFootnote
576113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfHtml
586113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfImage
596113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfLine
606113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfPageheader
616113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfText
626113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportPdfTextbox
636113edefSGreg Roach * @covers \Fisharebest\Webtrees\Report\ReportTcpdf
640e62c4b8SGreg Roach */
6584e2cf4eSGreg Roachclass BirthDeathMarriageReportModuleTest extends \Fisharebest\Webtrees\TestCase
66c1010edaSGreg Roach{
679a3accd7SGreg Roach    protected static $uses_database = true;
689a3accd7SGreg Roach
690e62c4b8SGreg Roach    /**
7052348eb8SGreg Roach     * @return void
710e62c4b8SGreg Roach     */
729a3accd7SGreg Roach    public function testReportRunsWithoutError(): void
73c1010edaSGreg Roach    {
749a3accd7SGreg Roach        $tree = $this->importTree('demo.ged');
759a3accd7SGreg Roach        app()->instance(Tree::class, $tree);
76*f397d0fdSGreg Roach        $xml  = Webtrees::ROOT_DIR . 'resources/xml/reports/bdm_report.xml';
779a3accd7SGreg Roach        $vars = [
789a3accd7SGreg Roach            'name'       => ['id' => ''],
799a3accd7SGreg Roach            'bdmplace'   => ['id' => ''],
809a3accd7SGreg Roach            'birthdate1' => ['id' => ''],
819a3accd7SGreg Roach            'birthdate2' => ['id' => ''],
829a3accd7SGreg Roach            'deathdate1' => ['id' => ''],
839a3accd7SGreg Roach            'deathdate2' => ['id' => ''],
849a3accd7SGreg Roach            'sortby'     => ['id' => 'BIRT:DATE'],
859a3accd7SGreg Roach            'pageSize'   => ['id' => 'A4'],
869a3accd7SGreg Roach        ];
879a3accd7SGreg Roach
889a3accd7SGreg Roach        ob_start();
899a3accd7SGreg Roach        new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
909a3accd7SGreg Roach        $html = ob_get_clean();
919a3accd7SGreg Roach        $this->assertStringStartsWith('<', $html);
929a3accd7SGreg Roach        $this->assertStringEndsWith('>', $html);
939a3accd7SGreg Roach
949a3accd7SGreg Roach        ob_start();
959a3accd7SGreg Roach        new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
969a3accd7SGreg Roach        $pdf = ob_get_clean();
979a3accd7SGreg Roach        $this->assertStringStartsWith('%PDF', $pdf);
989a3accd7SGreg Roach        $this->assertStringEndsWith("%%EOF\n", $pdf);
990e62c4b8SGreg Roach    }
1000e62c4b8SGreg Roach}
101