summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2026-02-02 15:37:59 +0000
committerGreg Roach <greg@subaqua.co.uk>2026-02-02 17:45:43 +0000
commitb0a01e7829fb411887ec057efcdec9cbfc40f6ca (patch)
tree0186634383d01bdcef32c3cbeab3e8e1aef7d8bc /tests
parent3d54aabd6609dc5c496e16c1ff435286425a4104 (diff)
downloadwebtrees-b0a01e7829fb411887ec057efcdec9cbfc40f6ca.tar.gz
webtrees-b0a01e7829fb411887ec057efcdec9cbfc40f6ca.tar.bz2
webtrees-b0a01e7829fb411887ec057efcdec9cbfc40f6ca.zip
Add tests cases for all report options
Diffstat (limited to 'tests')
-rw-r--r--tests/app/Module/AhnentafelReportModuleTest.php70
-rw-r--r--tests/app/Module/BirthDeathMarriageReportModuleTest.php80
-rw-r--r--tests/app/Module/BirthReportModuleTest.php58
-rw-r--r--tests/app/Module/CemeteryReportModuleTest.php52
-rw-r--r--tests/app/Module/ChangeReportModuleTest.php67
-rw-r--r--tests/app/Module/DeathReportModuleTest.php73
-rw-r--r--tests/app/Module/DescendancyReportModuleTest.php46
-rw-r--r--tests/app/Module/FactSourcesReportModuleTest.php46
-rw-r--r--tests/app/Module/FamilyGroupReportModuleTest.php64
-rw-r--r--tests/app/Module/IndividualFamiliesReportModuleTest.php120
-rw-r--r--tests/app/Module/IndividualReportModuleTest.php66
-rw-r--r--tests/app/Module/MarriageReportModuleTest.php58
-rw-r--r--tests/app/Module/MissingFactsReportModuleTest.php201
-rw-r--r--tests/app/Module/OccupationReportModuleTest.php40
-rw-r--r--tests/app/Module/PedigreeReportModuleTest.php45
-rw-r--r--tests/app/Module/RelatedIndividualsReportModuleTest.php75
-rw-r--r--tests/data/demo.ged4
-rw-r--r--tests/data/media/Elizabeth_II.jpgbin0 -> 14844 bytes
18 files changed, 1039 insertions, 126 deletions
diff --git a/tests/app/Module/AhnentafelReportModuleTest.php b/tests/app/Module/AhnentafelReportModuleTest.php
index 087a4082bb..9177eff5f7 100644
--- a/tests/app/Module/AhnentafelReportModuleTest.php
+++ b/tests/app/Module/AhnentafelReportModuleTest.php
@@ -49,8 +49,10 @@ use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
use Fisharebest\Webtrees\Services\UserService;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
use function ob_get_clean;
use function ob_start;
@@ -87,8 +89,56 @@ class AhnentafelReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'children' => 'on',
+ 'maxgen' => '-1',
+ 'notes' => 'on',
+ 'occu' => 'on',
+ 'page_size' => 'A4',
+ 'pid' => 'X1030',
+ 'resi' => 'on',
+ 'sources' => 'on',
+ ],
+ [
+ 'children' => '',
+ 'maxgen' => '3',
+ 'notes' => '',
+ 'occu' => '',
+ 'page_size' => 'US-Letter',
+ 'pid' => 'X1030',
+ 'resi' => '',
+ 'sources' => '',
+ ],
+ [
+ 'children' => '',
+ 'maxgen' => '',
+ 'notes' => '',
+ 'occu' => '',
+ 'page_size' => '',
+ 'pid' => '',
+ 'resi' => '',
+ 'sources' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $children,
+ string $maxgen,
+ string $notes,
+ string $occu,
+ string $page_size,
+ string $pid,
+ string $resi,
+ string $sources,
+ ): void {
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
$user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
@@ -99,18 +149,20 @@ class AhnentafelReportModuleTest extends TestCase
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'pid' => 'X1030',
- 'maxgen' => '3',
- 'sources' => 'on',
- 'pageSize' => 'A4',
- 'notes' => 'on',
- 'occu' => 'on',
- 'resi' => 'on',
- 'children' => 'on',
+ 'children' => $children,
+ 'maxgen' => $maxgen,
+ 'notes' => $notes,
+ 'occu' => $occu,
+ 'pageSize' => $page_size,
+ 'pid' => $pid,
+ 'resi' => $resi,
+ 'sources' => $sources,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/app/Module/BirthDeathMarriageReportModuleTest.php b/tests/app/Module/BirthDeathMarriageReportModuleTest.php
index 05fae47180..9b23197a6e 100644
--- a/tests/app/Module/BirthDeathMarriageReportModuleTest.php
+++ b/tests/app/Module/BirthDeathMarriageReportModuleTest.php
@@ -46,8 +46,10 @@ use Fisharebest\Webtrees\Report\ReportPdfLine;
use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
#[CoversClass(PedigreeReportModule::class)]
#[CoversClass(AbstractRenderer::class)]
@@ -81,26 +83,86 @@ class BirthDeathMarriageReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'name' => '',
+ 'bdmplace' => '',
+ 'birthdate1' => '01 JAN 1900',
+ 'birthdate2' => '31 DEC 1999',
+ 'deathdate1' => '',
+ 'deathdate2' => '',
+ 'sortby' => 'BIRT:DATE',
+ 'page_size' => 'A4',
+ ],
+ [
+ 'name' => '',
+ 'bdmplace' => '',
+ 'birthdate1' => '',
+ 'birthdate2' => '',
+ 'deathdate1' => '01 JAN 1900',
+ 'deathdate2' => '31 DEC 1999',
+ 'sortby' => 'DEAT:DATE',
+ 'page_size' => 'US-Letter',
+ ],
+ [
+ 'name' => 'Windsor',
+ 'bdmplace' => 'England',
+ 'birthdate1' => '',
+ 'birthdate2' => '',
+ 'deathdate1' => '',
+ 'deathdate2' => '',
+ 'sortby' => '',
+ 'page_size' => 'A4',
+ ],
+ [
+ 'name' => '',
+ 'bdmplace' => '',
+ 'birthdate1' => '',
+ 'birthdate2' => '',
+ 'deathdate1' => '',
+ 'deathdate2' => '',
+ 'sortby' => '',
+ 'page_size' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $name,
+ string $bdmplace,
+ string $birthdate1,
+ string $birthdate2,
+ string $deathdate1,
+ string $deathdate2,
+ string $sortby,
+ string $page_size,
+ ): void {
$tree = $this->importTree('demo.ged');
$module = new BirthDeathMarriageReportModule();
$module->setName('bdm_report');
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'name' => '',
- 'bdmplace' => '',
- 'birthdate1' => '',
- 'birthdate2' => '',
- 'deathdate1' => '',
- 'deathdate2' => '',
- 'sortby' => 'BIRT:DATE',
- 'pageSize' => 'A4',
+ 'name' => $name,
+ 'bdmplace' => $bdmplace,
+ 'birthdate1' => $birthdate1,
+ 'birthdate2' => $birthdate2,
+ 'deathdate1' => $deathdate1,
+ 'deathdate2' => $deathdate2,
+ 'sortby' => $sortby,
+ 'pageSize' => $page_size,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/app/Module/BirthReportModuleTest.php b/tests/app/Module/BirthReportModuleTest.php
index ed257ffdc0..162d4ea84f 100644
--- a/tests/app/Module/BirthReportModuleTest.php
+++ b/tests/app/Module/BirthReportModuleTest.php
@@ -49,8 +49,10 @@ use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
use Fisharebest\Webtrees\Services\UserService;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
use function ob_get_clean;
@@ -86,8 +88,48 @@ class BirthReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'birthdate1' => '',
+ 'birthdate2' => '',
+ 'birthplace' => 'England',
+ 'name' => 'Windsor',
+ 'page_size' => 'A4',
+ 'sortby' => 'NAME',
+ ],
+ [
+ 'birthdate1' => '01 JAN 1900',
+ 'birthdate2' => '31 DEC 1999',
+ 'birthplace' => '',
+ 'name' => '',
+ 'page_size' => 'US-Letter',
+ 'sortby' => 'BIRT:DATE',
+ ],
+ [
+ 'birthdate1' => '',
+ 'birthdate2' => '',
+ 'birthplace' => '',
+ 'name' => '',
+ 'page_size' => '',
+ 'sortby' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $birthdate1,
+ string $birthdate2,
+ string $birthplace,
+ string $name,
+ string $page_size,
+ string $sortby,
+ ): void {
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
$user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
@@ -98,16 +140,18 @@ class BirthReportModuleTest extends TestCase
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'name' => '',
- 'birthplace' => '',
- 'birthdate1' => '',
- 'birthdate2' => '',
- 'sortby' => 'NAME',
- 'pageSize' => 'A4',
+ 'birthdate1' => $birthdate1,
+ 'birthdate2' => $birthdate2,
+ 'birthplace' => $birthplace,
+ 'name' => $name,
+ 'pageSize' => $page_size,
+ 'sortby' => $sortby,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/app/Module/CemeteryReportModuleTest.php b/tests/app/Module/CemeteryReportModuleTest.php
index c19e0e2a0f..962b79d20c 100644
--- a/tests/app/Module/CemeteryReportModuleTest.php
+++ b/tests/app/Module/CemeteryReportModuleTest.php
@@ -49,8 +49,10 @@ use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
use Fisharebest\Webtrees\Services\UserService;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
use function ob_get_clean;
@@ -86,8 +88,46 @@ class CemeteryReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'adlist' => 'none',
+ 'deathplace' => 'England',
+ 'page_size' => 'A4',
+ 'sortby' => 'NAME',
+ ],
+ [
+ 'adlist' => '_MARNM',
+ 'deathplace' => '',
+ 'page_size' => 'US-Letter',
+ 'sortby' => 'DEAT:DATE',
+ ],
+ [
+ 'adlist' => 'HUSB',
+ 'deathplace' => '',
+ 'page_size' => 'A4',
+ 'sortby' => 'NAME',
+ ],
+ [
+ 'adlist' => '',
+ 'deathplace' => '',
+ 'page_size' => '',
+ 'sortby' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $adlist,
+ string $deathplace,
+ string $page_size,
+ string $sortby,
+ ): void {
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
$user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
@@ -98,14 +138,16 @@ class CemeteryReportModuleTest extends TestCase
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'deathplace' => '',
- 'adlist' => 'none',
- 'sortby' => 'NAME',
- 'pageSize' => 'A4',
+ 'adlist' => $adlist,
+ 'deathplace' => $deathplace,
+ 'pageSize' => $page_size,
+ 'sortby' => $sortby,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/app/Module/ChangeReportModuleTest.php b/tests/app/Module/ChangeReportModuleTest.php
index f8d63d611c..6ee7fdd3bd 100644
--- a/tests/app/Module/ChangeReportModuleTest.php
+++ b/tests/app/Module/ChangeReportModuleTest.php
@@ -21,7 +21,6 @@ namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Contracts\UserInterface;
-use Fisharebest\Webtrees\Registry;
use Fisharebest\Webtrees\Report\AbstractRenderer;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\PdfRenderer;
@@ -50,8 +49,10 @@ use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
use Fisharebest\Webtrees\Services\UserService;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
use function ob_get_clean;
@@ -87,8 +88,56 @@ class ChangeReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'change_range_start' => '01 JAN 2020',
+ 'change_range_end' => '31 DEC 2030',
+ 'pending' => 'yes',
+ 'sortby' => 'CHAN',
+ 'page_size' => 'A4',
+ 'pageorient' => 'landscape',
+ ],
+ [
+ 'change_range_start' => '01 JAN 2020',
+ 'change_range_end' => '31 DEC 2030',
+ 'pending' => 'no',
+ 'sortby' => 'NAME',
+ 'page_size' => 'US-Letter',
+ 'pageorient' => 'portrait',
+ ],
+ [
+ 'change_range_start' => '01 JAN 2020',
+ 'change_range_end' => '31 DEC 2030',
+ 'pending' => 'yes',
+ 'sortby' => 'BIRT:DATE',
+ 'page_size' => 'A4',
+ 'pageorient' => 'landscape',
+ ],
+ [
+ 'change_range_start' => '',
+ 'change_range_end' => '',
+ 'pending' => '',
+ 'sortby' => '',
+ 'page_size' => '',
+ 'pageorient' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $change_range_start,
+ string $change_range_end,
+ string $pending,
+ string $sortby,
+ string $page_size,
+ string $pageorient,
+ ): void {
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
$user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
@@ -99,16 +148,18 @@ class ChangeReportModuleTest extends TestCase
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'changeRangeStart' => Registry::timestampFactory()->now()->subtractMonths(1)->format('d M Y'),
- 'changeRangeEnd' => Registry::timestampFactory()->now()->format('d M Y'),
- 'pending' => 'yes',
- 'sortby' => 'CHAN',
- 'pageSize' => 'A4',
- 'pageorient' => 'landscape',
+ 'changeRangeStart' => $change_range_start,
+ 'changeRangeEnd' => $change_range_end,
+ 'pending' => $pending,
+ 'sortby' => $sortby,
+ 'pageSize' => $page_size,
+ 'pageorient' => $pageorient,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/app/Module/DeathReportModuleTest.php b/tests/app/Module/DeathReportModuleTest.php
index bd561e57c8..4bf31da855 100644
--- a/tests/app/Module/DeathReportModuleTest.php
+++ b/tests/app/Module/DeathReportModuleTest.php
@@ -49,8 +49,10 @@ use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
use Fisharebest\Webtrees\Services\UserService;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
use function ob_get_clean;
@@ -86,8 +88,61 @@ class DeathReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'adlist' => 'none',
+ 'deathdate1' => '',
+ 'deathdate2' => '',
+ 'deathplace' => 'England',
+ 'name' => 'Windsor',
+ 'page_size' => 'A4',
+ 'sortby' => 'NAME',
+ ],
+ [
+ 'adlist' => '_MARNM',
+ 'deathdate1' => '01 JAN 1900',
+ 'deathdate2' => '31 DEC 1999',
+ 'deathplace' => '',
+ 'name' => '',
+ 'page_size' => 'US-Letter',
+ 'sortby' => 'DEAT:DATE',
+ ],
+ [
+ 'adlist' => 'HUSB',
+ 'deathdate1' => '',
+ 'deathdate2' => '',
+ 'deathplace' => '',
+ 'name' => '',
+ 'page_size' => 'A4',
+ 'sortby' => 'NAME',
+ ],
+ [
+ 'adlist' => '',
+ 'deathdate1' => '',
+ 'deathdate2' => '',
+ 'deathplace' => '',
+ 'name' => '',
+ 'page_size' => '',
+ 'sortby' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $adlist,
+ string $deathdate1,
+ string $deathdate2,
+ string $deathplace,
+ string $name,
+ string $page_size,
+ string $sortby,
+ ): void {
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
$user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
@@ -98,17 +153,19 @@ class DeathReportModuleTest extends TestCase
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'name' => '',
- 'deathplace' => '',
- 'deathdate1' => '',
- 'deathdate2' => '',
- 'adlist' => 'none',
- 'sortby' => 'NAME',
- 'pageSize' => 'A4',
+ 'adlist' => $adlist,
+ 'deathdate1' => $deathdate1,
+ 'deathdate2' => $deathdate2,
+ 'deathplace' => $deathplace,
+ 'name' => $name,
+ 'pageSize' => $page_size,
+ 'sortby' => $sortby,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/app/Module/DescendancyReportModuleTest.php b/tests/app/Module/DescendancyReportModuleTest.php
index d852bb0eb4..6bd0b91cfb 100644
--- a/tests/app/Module/DescendancyReportModuleTest.php
+++ b/tests/app/Module/DescendancyReportModuleTest.php
@@ -49,8 +49,10 @@ use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
use Fisharebest\Webtrees\Services\UserService;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
use function ob_get_clean;
use function ob_start;
@@ -87,8 +89,40 @@ class DescendancyReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'maxgen' => '-1',
+ 'page_size' => 'A4',
+ 'pid' => 'X1030',
+ 'sources' => 'on',
+ ],
+ [
+ 'maxgen' => '3',
+ 'page_size' => 'US-Letter',
+ 'pid' => 'X1030',
+ 'sources' => '',
+ ],
+ [
+ 'maxgen' => '',
+ 'page_size' => '',
+ 'pid' => '',
+ 'sources' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $maxgen,
+ string $page_size,
+ string $pid,
+ string $sources
+ ): void {
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
$user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
@@ -99,14 +133,16 @@ class DescendancyReportModuleTest extends TestCase
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'pid' => 'X1030',
- 'maxgen' => '3',
- 'sources' => 'on',
- 'pageSize' => 'A4',
+ 'maxgen' => $maxgen,
+ 'pageSize' => $page_size,
+ 'pid' => $pid,
+ 'sources' => $sources,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/app/Module/FactSourcesReportModuleTest.php b/tests/app/Module/FactSourcesReportModuleTest.php
index 1df686e3de..11a878c12b 100644
--- a/tests/app/Module/FactSourcesReportModuleTest.php
+++ b/tests/app/Module/FactSourcesReportModuleTest.php
@@ -49,8 +49,10 @@ use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
use Fisharebest\Webtrees\Services\UserService;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
use function ob_get_clean;
@@ -86,8 +88,40 @@ class FactSourcesReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'page_size' => 'A4',
+ 'sid' => 'X1102',
+ 'sortby' => 'BIRT:DATE',
+ 'stype' => 'facts',
+ ],
+ [
+ 'page_size' => 'US-Letter',
+ 'sid' => 'X1102',
+ 'sortby' => 'NAME',
+ 'stype' => 'records',
+ ],
+ [
+ 'page_size' => '',
+ 'sid' => '',
+ 'sortby' => '',
+ 'stype' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $page_size,
+ string $sid,
+ string $sortby,
+ string $stype,
+ ): void {
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
$user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
@@ -98,14 +132,16 @@ class FactSourcesReportModuleTest extends TestCase
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'sid' => 'X1102',
- 'stype' => 'facts',
- 'sortby' => 'BIRT:DATE',
- 'pageSize' => 'A4',
+ 'pageSize' => $page_size,
+ 'sid' => $sid,
+ 'sortby' => $sortby,
+ 'stype' => $stype,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/app/Module/FamilyGroupReportModuleTest.php b/tests/app/Module/FamilyGroupReportModuleTest.php
index 10dbb4f591..3c87b4c0ce 100644
--- a/tests/app/Module/FamilyGroupReportModuleTest.php
+++ b/tests/app/Module/FamilyGroupReportModuleTest.php
@@ -49,8 +49,10 @@ use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
use Fisharebest\Webtrees\Services\UserService;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
use function ob_get_clean;
@@ -86,8 +88,52 @@ class FamilyGroupReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'blanks' => 'on',
+ 'colors' => 'on',
+ 'id' => 'f1',
+ 'notes' => 'on',
+ 'page_size' => 'A4',
+ 'photos' => 'on',
+ 'sources' => 'on',
+ ],
+ [
+ 'blanks' => '',
+ 'colors' => '',
+ 'id' => 'f1',
+ 'notes' => '',
+ 'page_size' => 'US-Letter',
+ 'photos' => '',
+ 'sources' => '',
+ ],
+ [
+ 'blanks' => '',
+ 'colors' => '',
+ 'id' => '',
+ 'notes' => '',
+ 'page_size' => '',
+ 'photos' => '',
+ 'sources' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $blanks,
+ string $colors,
+ string $id,
+ string $notes,
+ string $page_size,
+ string $photos,
+ string $sources,
+ ): void {
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
$user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
@@ -98,17 +144,19 @@ class FamilyGroupReportModuleTest extends TestCase
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'id' => 'f1',
- 'sources' => 'on',
- 'notes' => 'on',
- 'photos' => 'on',
- 'colors' => 'on',
- 'blanks' => 'on',
- 'pageSize' => 'A4',
+ 'blanks' => $blanks,
+ 'colors' => $colors,
+ 'id' => $id,
+ 'notes' => $notes,
+ 'pageSize' => $page_size,
+ 'photos' => $photos,
+ 'sources' => $sources,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/app/Module/IndividualFamiliesReportModuleTest.php b/tests/app/Module/IndividualFamiliesReportModuleTest.php
index 500c42aae5..69a16c0e7e 100644
--- a/tests/app/Module/IndividualFamiliesReportModuleTest.php
+++ b/tests/app/Module/IndividualFamiliesReportModuleTest.php
@@ -49,8 +49,10 @@ use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
use Fisharebest\Webtrees\Services\UserService;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
use function ob_get_clean;
use function ob_start;
@@ -87,8 +89,104 @@ class IndividualFamiliesReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'colors' => 'on',
+ 'maxgen' => '4',
+ 'notes' => 'on',
+ 'page_size' => 'A4',
+ 'photos' => 'none',
+ 'pid' => 'X1030',
+ 'relatives' => 'child-families',
+ 'sortby' => 'BIRT:DATE',
+ 'sources' => 'on',
+ ],
+ [
+ 'colors' => '',
+ 'maxgen' => '4',
+ 'notes' => '',
+ 'page_size' => 'A4',
+ 'photos' => 'all',
+ 'pid' => 'X1030',
+ 'relatives' => 'child-family',
+ 'sortby' => 'BIRT:DATE',
+ 'sources' => '',
+ ],
+ [
+ 'colors' => 'on',
+ 'maxgen' => '4',
+ 'notes' => 'on',
+ 'page_size' => 'A4',
+ 'photos' => 'all',
+ 'pid' => 'X1030',
+ 'relatives' => 'spouse-families',
+ 'sortby' => 'BIRT:DATE',
+ 'sources' => 'on',
+ ],
+ [
+ 'colors' => '',
+ 'maxgen' => '4',
+ 'notes' => '',
+ 'page_size' => 'US-Letter',
+ 'photos' => 'highlighted',
+ 'pid' => 'X1030',
+ 'relatives' => 'direct-ancestors',
+ 'sortby' => 'NAME',
+ 'sources' => '',
+ ],
+ [
+ 'colors' => 'on',
+ 'maxgen' => '4',
+ 'notes' => 'on',
+ 'page_size' => 'US-Letter',
+ 'photos' => 'highlighted',
+ 'pid' => 'X1030',
+ 'relatives' => 'descendants',
+ 'sortby' => 'NAME',
+ 'sources' => 'on',
+ ],
+ [
+ 'colors' => '',
+ 'maxgen' => '4',
+ 'notes' => '',
+ 'page_size' => 'US-Letter',
+ 'photos' => 'highlighted',
+ 'pid' => 'X1030',
+ 'relatives' => 'all',
+ 'sortby' => 'NAME',
+ 'sources' => '',
+ ],
+ [
+ 'colors' => '',
+ 'maxgen' => '',
+ 'notes' => '',
+ 'page_size' => '',
+ 'photos' => '',
+ 'pid' => '',
+ 'relatives' => '',
+ 'sortby' => '',
+ 'sources' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $colors,
+ string $maxgen,
+ string $notes,
+ string $page_size,
+ string $photos,
+ string $pid,
+ string $relatives,
+ string $sortby,
+ string $sources,
+ ): void {
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
$user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
@@ -99,19 +197,21 @@ class IndividualFamiliesReportModuleTest extends TestCase
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'pid' => 'X1030',
- 'relatives' => 'child-families',
- 'maxgen' => '4',
- 'sortby' => 'BIRT:DATE',
- 'sources' => 'on',
- 'notes' => 'on',
- 'photos' => 'on',
- 'pageSize' => 'A4',
- 'colors' => 'on',
+ 'colors' => $colors,
+ 'maxgen' => $maxgen,
+ 'notes' => $notes,
+ 'pageSize' => $page_size,
+ 'photos' => $photos,
+ 'pid' => $pid,
+ 'relatives' => $relatives,
+ 'sortby' => $sortby,
+ 'sources' => $sources,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/app/Module/IndividualReportModuleTest.php b/tests/app/Module/IndividualReportModuleTest.php
index ac976e98dd..9afba0b897 100644
--- a/tests/app/Module/IndividualReportModuleTest.php
+++ b/tests/app/Module/IndividualReportModuleTest.php
@@ -49,8 +49,10 @@ use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
use Fisharebest\Webtrees\Services\UserService;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
#[CoversClass(PedigreeReportModule::class)]
#[CoversClass(AbstractRenderer::class)]
@@ -84,8 +86,56 @@ class IndividualReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'colors' => 'on',
+ 'id' => 'X1030',
+ 'notes' => 'on',
+ 'page_size' => 'A4',
+ 'photos' => 'all',
+ 'sources' => 'on',
+ ],
+ [
+ 'colors' => '',
+ 'id' => 'X1030',
+ 'notes' => '',
+ 'page_size' => 'A4',
+ 'photos' => 'highlighted',
+ 'sources' => '',
+ ],
+ [
+ 'colors' => 'on',
+ 'id' => 'X1030',
+ 'notes' => 'on',
+ 'page_size' => 'US-Letter',
+ 'photos' => 'none',
+ 'sources' => 'on',
+ ],
+ [
+ 'colors' => '',
+ 'id' => '',
+ 'notes' => '',
+ 'page_size' => '',
+ 'photos' => '',
+ 'sources' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $colors,
+ string $id,
+ string $notes,
+ string $page_size,
+ string $photos,
+ string $sources
+ ): void {
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
$user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
@@ -96,16 +146,18 @@ class IndividualReportModuleTest extends TestCase
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'id' => 'X1030',
- 'sources' => 'on',
- 'notes' => 'on',
- 'photos' => 'all',
- 'colors' => 'on',
- 'pageSize' => 'A4',
+ 'colors' => $colors,
+ 'id' => $id,
+ 'notes' => $notes,
+ 'pageSize' => $page_size,
+ 'photos' => $photos,
+ 'sources' => $sources,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/app/Module/MarriageReportModuleTest.php b/tests/app/Module/MarriageReportModuleTest.php
index e6e9478514..4d5d116d5a 100644
--- a/tests/app/Module/MarriageReportModuleTest.php
+++ b/tests/app/Module/MarriageReportModuleTest.php
@@ -49,8 +49,10 @@ use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
use Fisharebest\Webtrees\Services\UserService;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
#[CoversClass(PedigreeReportModule::class)]
#[CoversClass(AbstractRenderer::class)]
@@ -84,8 +86,48 @@ class MarriageReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'marrdate1' => '01 JAN 1900',
+ 'marrdate2' => '31 DEC 1999',
+ 'marrplace' => 'England',
+ 'name' => 'Mountbatten',
+ 'page_size' => 'A4',
+ 'sortby' => 'NAME',
+ ],
+ [
+ 'marrdate1' => '01 JAN 1900',
+ 'marrdate2' => '31 DEC 1999',
+ 'marrplace' => 'England',
+ 'name' => 'Windsor',
+ 'page_size' => 'US-Letter',
+ 'sortby' => 'MARR:DATE',
+ ],
+ [
+ 'marrdate1' => '',
+ 'marrdate2' => '',
+ 'marrplace' => '',
+ 'name' => '',
+ 'page_size' => '',
+ 'sortby' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $marrdate1,
+ string $marrdate2,
+ string $marrplace,
+ string $name,
+ string $page_size,
+ string $sortby,
+ ): void {
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
$user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
@@ -96,16 +138,18 @@ class MarriageReportModuleTest extends TestCase
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'name' => '',
- 'marrplace' => '',
- 'marrdate1' => '',
- 'marrdate2' => '',
- 'sortby' => 'NAME',
- 'pageSize' => 'A4',
+ 'marrdate1' => $marrdate1,
+ 'marrdate2' => $marrdate2,
+ 'marrplace' => $marrplace,
+ 'name' => $name,
+ 'pageSize' => $page_size,
+ 'sortby' => $sortby,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/app/Module/MissingFactsReportModuleTest.php b/tests/app/Module/MissingFactsReportModuleTest.php
index 5c5e038dfe..bbd2f98c73 100644
--- a/tests/app/Module/MissingFactsReportModuleTest.php
+++ b/tests/app/Module/MissingFactsReportModuleTest.php
@@ -49,8 +49,10 @@ use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
use Fisharebest\Webtrees\Services\UserService;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
#[CoversClass(PedigreeReportModule::class)]
#[CoversClass(AbstractRenderer::class)]
@@ -84,8 +86,168 @@ class MissingFactsReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'fbapm' => 'on',
+ 'fbarm' => '',
+ 'fbasm' => 'on',
+ 'fbirt' => '',
+ 'fburi' => 'on',
+ 'fconf' => '',
+ 'fdeat' => 'on',
+ 'fenga' => '',
+ 'ffcom' => 'on',
+ 'fmarb' => '',
+ 'fmarr' => 'on',
+ 'freli' => '',
+ 'fsour' => 'on',
+ 'maxgen' => '-1',
+ 'page_size' => 'A4',
+ 'pid' => 'X1030',
+ 'relatives' => 'child-family',
+ ],
+ [
+ 'fbapm' => '',
+ 'fbarm' => 'on',
+ 'fbasm' => '',
+ 'fbirt' => 'on',
+ 'fburi' => '',
+ 'fconf' => 'on',
+ 'fdeat' => '',
+ 'fenga' => 'on',
+ 'ffcom' => '',
+ 'fmarb' => 'on',
+ 'fmarr' => '',
+ 'freli' => 'on',
+ 'fsour' => '',
+ 'maxgen' => '-1',
+ 'page_size' => 'US-Letter',
+ 'pid' => 'X1030',
+ 'relatives' => 'spouse-family',
+ ],
+ [
+ 'fbapm' => 'on',
+ 'fbarm' => '',
+ 'fbasm' => 'on',
+ 'fbirt' => '',
+ 'fburi' => 'on',
+ 'fconf' => '',
+ 'fdeat' => 'on',
+ 'fenga' => '',
+ 'ffcom' => 'on',
+ 'fmarb' => '',
+ 'fmarr' => 'on',
+ 'freli' => '',
+ 'fsour' => 'on',
+ 'maxgen' => '-1',
+ 'page_size' => 'A4',
+ 'pid' => 'X1030',
+ 'relatives' => 'direct-ancestors',
+ ],
+ [
+ 'fbapm' => '',
+ 'fbarm' => 'on',
+ 'fbasm' => '',
+ 'fbirt' => 'on',
+ 'fburi' => '',
+ 'fconf' => 'on',
+ 'fdeat' => '',
+ 'fenga' => 'on',
+ 'ffcom' => '',
+ 'fmarb' => 'on',
+ 'fmarr' => '',
+ 'freli' => 'on',
+ 'fsour' => '',
+ 'maxgen' => '-1',
+ 'page_size' => 'US-Letter',
+ 'pid' => 'X1030',
+ 'relatives' => 'ancestors',
+ ],
+ [
+ 'fbapm' => 'on',
+ 'fbarm' => '',
+ 'fbasm' => 'on',
+ 'fbirt' => '',
+ 'fburi' => 'on',
+ 'fconf' => '',
+ 'fdeat' => 'on',
+ 'fenga' => '',
+ 'ffcom' => 'on',
+ 'fmarb' => '',
+ 'fmarr' => 'on',
+ 'freli' => '',
+ 'fsour' => 'on',
+ 'maxgen' => '-1',
+ 'page_size' => 'A4',
+ 'pid' => 'X1030',
+ 'relatives' => 'descendants',
+ ],
+ [
+ 'fbapm' => '',
+ 'fbarm' => 'on',
+ 'fbasm' => '',
+ 'fbirt' => 'on',
+ 'fburi' => '',
+ 'fconf' => 'on',
+ 'fdeat' => '',
+ 'fenga' => 'on',
+ 'ffcom' => '',
+ 'fmarb' => 'on',
+ 'fmarr' => '',
+ 'freli' => 'on',
+ 'fsour' => '',
+ 'maxgen' => '-1',
+ 'page_size' => 'US-Letter',
+ 'pid' => 'X1030',
+ 'relatives' => 'all',
+ ],
+ [
+ 'fbapm' => '',
+ 'fbarm' => '',
+ 'fbasm' => '',
+ 'fbirt' => '',
+ 'fburi' => '',
+ 'fconf' => '',
+ 'fdeat' => '',
+ 'fenga' => '',
+ 'ffcom' => '',
+ 'fmarb' => '',
+ 'fmarr' => '',
+ 'freli' => '',
+ 'fsour' => '',
+ 'maxgen' => '',
+ 'page_size' => '',
+ 'pid' => '',
+ 'relatives' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $fbapm,
+ string $fbarm,
+ string $fbasm,
+ string $fbirt,
+ string $fburi,
+ string $fconf,
+ string $fdeat,
+ string $fenga,
+ string $ffcom,
+ string $fmarb,
+ string $fmarr,
+ string $freli,
+ string $fsour,
+ string $maxgen,
+ string $page_size,
+ string $pid,
+ string $relatives,
+ ): void {
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
$user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
@@ -96,28 +258,29 @@ class MissingFactsReportModuleTest extends TestCase
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'pid' => 'X1030',
- 'relatives' => 'direct-ancestors',
- 'maxgen' => '*',
- 'pageSize' => 'A4',
- 'sortby' => 'NAME',
- 'fbirt' => 'on',
- 'fburi' => 'on',
- 'fdeat' => 'on',
- 'fsour' => 'on',
- 'fbapm' => 'on',
- 'fbarm' => 'on',
- 'fbasm' => 'on',
- 'fconf' => 'on',
- 'fenga' => 'on',
- 'ffcom' => 'on',
- 'fmarb' => 'on',
- 'fmarr' => 'on',
- 'freli' => 'on',
+ 'fbapm' => $fbapm,
+ 'fbarm' => $fbarm,
+ 'fbasm' => $fbasm,
+ 'fbirt' => $fbirt,
+ 'fburi' => $fburi,
+ 'fconf' => $fconf,
+ 'fdeat' => $fdeat,
+ 'fenga' => $fenga,
+ 'ffcom' => $ffcom,
+ 'fmarb' => $fmarb,
+ 'fmarr' => $fmarr,
+ 'freli' => $freli,
+ 'fsour' => $fsour,
+ 'maxgen' => $maxgen,
+ 'pageSize' => $page_size,
+ 'pid' => $pid,
+ 'relatives' => $relatives,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/app/Module/OccupationReportModuleTest.php b/tests/app/Module/OccupationReportModuleTest.php
index 564af569b9..8e159c940d 100644
--- a/tests/app/Module/OccupationReportModuleTest.php
+++ b/tests/app/Module/OccupationReportModuleTest.php
@@ -49,8 +49,10 @@ use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
use Fisharebest\Webtrees\Services\UserService;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
#[CoversClass(PedigreeReportModule::class)]
#[CoversClass(AbstractRenderer::class)]
@@ -84,8 +86,36 @@ class OccupationReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'occupation' => 'Queen',
+ 'page_size' => 'A4',
+ 'sortby' => 'NAME',
+ ],
+ [
+ 'occupation' => 'Queen',
+ 'page_size' => 'US-Letter',
+ 'sortby' => 'NAME',
+ ],
+ [
+ 'occupation' => '',
+ 'page_size' => '',
+ 'sortby' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $occupation,
+ string $page_size,
+ string $sortby,
+ ): void {
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
$user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
@@ -96,13 +126,15 @@ class OccupationReportModuleTest extends TestCase
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'occupation' => 'king',
- 'pageSize' => 'A4',
- 'sortby' => 'NAME',
+ 'occupation' => $occupation,
+ 'pageSize' => $page_size,
+ 'sortby' => $sortby,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/app/Module/PedigreeReportModuleTest.php b/tests/app/Module/PedigreeReportModuleTest.php
index b906b09265..a089c15ada 100644
--- a/tests/app/Module/PedigreeReportModuleTest.php
+++ b/tests/app/Module/PedigreeReportModuleTest.php
@@ -49,8 +49,10 @@ use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
use Fisharebest\Webtrees\Services\UserService;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
#[CoversClass(PedigreeReportModule::class)]
#[CoversClass(AbstractRenderer::class)]
@@ -84,8 +86,40 @@ class PedigreeReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'orientation' => 'portrait',
+ 'page_size' => 'A4',
+ 'pid' => 'X1030',
+ 'spouses' => 'on',
+ ],
+ [
+ 'orientation' => 'landscape',
+ 'page_size' => 'US-Letter',
+ 'pid' => 'X1030',
+ 'spouses' => '',
+ ],
+ [
+ 'orientation' => 'portrait', // Without this parameter, there is no output at all.
+ 'page_size' => '',
+ 'pid' => '',
+ 'spouses' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $orientation,
+ string $page_size,
+ string $pid,
+ string $spouses,
+ ): void {
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
$user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
@@ -96,13 +130,16 @@ class PedigreeReportModuleTest extends TestCase
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'pid' => 'X1030',
- 'spouses' => 'on',
- 'orientation' => 'portrait',
+ 'orientation' => $orientation,
+ 'pageSize' => $page_size,
+ 'pid' => $pid,
+ 'spouses' => $spouses,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/app/Module/RelatedIndividualsReportModuleTest.php b/tests/app/Module/RelatedIndividualsReportModuleTest.php
index 1d2902ea35..1690637cc9 100644
--- a/tests/app/Module/RelatedIndividualsReportModuleTest.php
+++ b/tests/app/Module/RelatedIndividualsReportModuleTest.php
@@ -49,8 +49,10 @@ use Fisharebest\Webtrees\Report\ReportPdfText;
use Fisharebest\Webtrees\Report\ReportPdfTextBox;
use Fisharebest\Webtrees\Report\TcpdfWrapper;
use Fisharebest\Webtrees\Services\UserService;
+use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
#[CoversClass(PedigreeReportModule::class)]
#[CoversClass(AbstractRenderer::class)]
@@ -84,8 +86,64 @@ class RelatedIndividualsReportModuleTest extends TestCase
{
protected static bool $uses_database = true;
- public function testReportRunsWithoutError(): void
+ /**
+ * @return array<int,array<string,string>>
+ */
+ public static function reportOptions(): array
{
+ return [
+ [
+ 'page_size' => 'A4',
+ 'pid' => 'X1030',
+ 'relatives' => 'child-family',
+ 'sortby' => 'NAME',
+ ],
+ [
+ 'page_size' => 'US-Letter',
+ 'pid' => 'X1030',
+ 'relatives' => 'spouse-family',
+ 'sortby' => 'BIRT:DATE',
+ ],
+ [
+ 'page_size' => 'A4',
+ 'pid' => 'X1030',
+ 'relatives' => 'direct-ancestors',
+ 'sortby' => 'DEAT:DATE',
+ ],
+ [
+ 'page_size' => 'US-Letter',
+ 'pid' => 'X1030',
+ 'relatives' => 'ancestors',
+ 'sortby' => 'NAME',
+ ],
+ [
+ 'page_size' => 'A4',
+ 'pid' => 'X1030',
+ 'relatives' => 'descendants',
+ 'sortby' => 'BIRT:DATE',
+ ],
+ [
+ 'page_size' => 'US-Letter',
+ 'pid' => 'X1030',
+ 'relatives' => 'all',
+ 'sortby' => 'DEAT:DATE',
+ ],
+ [
+ 'page_size' => '',
+ 'pid' => '',
+ 'relatives' => '',
+ 'sortby' => '',
+ ],
+ ];
+ }
+
+ #[DataProvider('reportOptions')]
+ public function testReportRunsWithoutError(
+ string $page_size,
+ string $pid,
+ string $relatives,
+ string $sortby,
+ ): void {
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
$user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
@@ -96,19 +154,16 @@ class RelatedIndividualsReportModuleTest extends TestCase
$xml = 'resources/' . $module->xmlFilename();
$vars = [
- 'pid' => 'X1030',
- 'relatives' => 'child-family',
- 'maxgen' => '4',
- 'sortby' => 'BIRT:DATE',
- 'sources' => 'on',
- 'notes' => 'on',
- 'photos' => 'all',
- 'colors' => 'on',
- 'pageSize' => 'A4',
+ 'pageSize' => $page_size,
+ 'pid' => $pid,
+ 'relatives' => $relatives,
+ 'sortby' => $sortby,
];
new ReportParserSetup($xml);
+ Site::setPreference('INDEX_DIRECTORY', 'tests/data/');
+
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
$html = ob_get_clean();
diff --git a/tests/data/demo.ged b/tests/data/demo.ged
index 927172a570..1e43a636ba 100644
--- a/tests/data/demo.ged
+++ b/tests/data/demo.ged
@@ -29,6 +29,7 @@
4 TEXT Name: Elizabeth A M Windsor
5 CONT Mother’s maiden surname: Bowes-Lyon
3 OBJE @X1161@
+1 OCCU Queen
1 CHAN
2 DATE 03 FEB 2013
3 TIME 17:42:33
@@ -1327,6 +1328,7 @@
3 TIME 09:06:53
2 _WT_USER greg
1 FAMS @f29@
+1 OCCU Queen
1 BIRT
2 DATE 24 MAY 1819
2 SOUR @X1102@
@@ -1881,7 +1883,7 @@
3 TIME 15:30:44
2 _WT_USER greg
0 @X1104@ OBJE
-1 FILE Elizabeth_II_greets_NASA_GSFC_employees,_May_8,_2007_edit.jpg
+1 FILE Elizabeth_II.jpg
2 TITL Queen Elizabeth II
1 NOTE Image downloaded from https://en.wikipedia.org/wiki/Elizabeth_II on 24th May 2012
1 CHAN
diff --git a/tests/data/media/Elizabeth_II.jpg b/tests/data/media/Elizabeth_II.jpg
new file mode 100644
index 0000000000..1b10d5e8c5
--- /dev/null
+++ b/tests/data/media/Elizabeth_II.jpg
Binary files differ