summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Report/ReportParserGenerate.php2
-rw-r--r--tests/TestCase.php2
-rw-r--r--tests/app/Module/AhnentafelReportModuleTest.php41
-rw-r--r--tests/app/Module/BirthDeathMarriageReportModuleTest.php41
-rw-r--r--tests/app/Module/BirthReportModuleTest.php39
-rw-r--r--tests/app/Module/CemeteryReportModuleTest.php37
-rw-r--r--tests/app/Module/ChangeReportModuleTest.php40
-rw-r--r--tests/app/Module/DeathReportModuleTest.php40
-rw-r--r--tests/app/Module/DescendancyReportModuleTest.php37
-rw-r--r--tests/app/Module/FactSourcesReportModuleTest.php37
-rw-r--r--tests/app/Module/FamilyGroupReportModuleTest.php40
-rw-r--r--tests/app/Module/IndividualFamiliesReportModuleTest.php42
-rw-r--r--tests/app/Module/IndividualReportModuleTest.php39
-rw-r--r--tests/app/Module/MarriageReportModuleTest.php39
-rw-r--r--tests/app/Module/MissingFactsReportModuleTest.php50
-rw-r--r--tests/app/Module/OccupationReportModuleTest.php36
-rw-r--r--tests/app/Module/PedigreeReportModuleTest.php35
-rw-r--r--tests/app/Module/RelatedIndividualsReportModuleTest.php42
-rw-r--r--tests/feature/IndividualListTest.php3
19 files changed, 573 insertions, 69 deletions
diff --git a/app/Report/ReportParserGenerate.php b/app/Report/ReportParserGenerate.php
index f1b0329a9b..163eb31cc4 100644
--- a/app/Report/ReportParserGenerate.php
+++ b/app/Report/ReportParserGenerate.php
@@ -674,7 +674,7 @@ class ReportParserGenerate extends ReportParserBase
}
} else {
$temp = explode(' ', trim($tgedrec));
- $level = $temp[0] + 1;
+ $level = 1 + (int) $temp[0];
$newgedrec = Functions::getSubRecord($level, "$level $tag", $tgedrec);
$tgedrec = $newgedrec;
}
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 7e66040925..438d7083a3 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -95,7 +95,7 @@ class TestCase extends \PHPUnit\Framework\TestCase
defined('WT_ROOT') || define('WT_ROOT', dirname(__DIR__) . '/');
defined('WT_BASE_URL') || define('WT_BASE_URL', 'http://localhost/');
defined('WT_DATA_DIR') || define('WT_DATA_DIR', WT_ROOT . 'data/');
- defined('WT_LOCALE') || define('WT_LOCALE', I18N::init('en-US', null, false));
+ defined('WT_LOCALE') || define('WT_LOCALE', I18N::init('en-US', null, true));
if (static::$uses_database) {
DB::connection()->beginTransaction();
diff --git a/tests/app/Module/AhnentafelReportModuleTest.php b/tests/app/Module/AhnentafelReportModuleTest.php
index 6fa3f60335..44066b351b 100644
--- a/tests/app/Module/AhnentafelReportModuleTest.php
+++ b/tests/app/Module/AhnentafelReportModuleTest.php
@@ -17,18 +17,51 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+
/**
* Test harness for the class AhnentafelReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class AhnentafelReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\AhnentafelReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/ahnentafel_report.xml';
+ $vars = [
+ 'pid' => ['id' => 'i1'],
+ 'maxgen' => ['id' => '3'],
+ 'sources' => ['id' => 'on'],
+ 'pageSize' => ['id' => 'A4'],
+ 'notes' => ['id' => 'on'],
+ 'occu' => ['id' => 'on'],
+ 'resi' => ['id' => 'on'],
+ 'children' => ['id' => 'on'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/app/Module/BirthDeathMarriageReportModuleTest.php b/tests/app/Module/BirthDeathMarriageReportModuleTest.php
index 29c130966c..4f5c159c13 100644
--- a/tests/app/Module/BirthDeathMarriageReportModuleTest.php
+++ b/tests/app/Module/BirthDeathMarriageReportModuleTest.php
@@ -17,18 +17,51 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+
/**
* Test harness for the class BirthDeathMarriageReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class BirthDeathMarriageReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\BirthDeathMarriageReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/bdm_report.xml';
+ $vars = [
+ 'name' => ['id' => ''],
+ 'bdmplace' => ['id' => ''],
+ 'birthdate1' => ['id' => ''],
+ 'birthdate2' => ['id' => ''],
+ 'deathdate1' => ['id' => ''],
+ 'deathdate2' => ['id' => ''],
+ 'sortby' => ['id' => 'BIRT:DATE'],
+ 'pageSize' => ['id' => 'A4'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/app/Module/BirthReportModuleTest.php b/tests/app/Module/BirthReportModuleTest.php
index 41adab5ac4..8e1e58e59e 100644
--- a/tests/app/Module/BirthReportModuleTest.php
+++ b/tests/app/Module/BirthReportModuleTest.php
@@ -17,18 +17,49 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+
/**
* Test harness for the class BirthReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class BirthReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\BirthReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/birth_report.xml';
+ $vars = [
+ 'name' => ['id' => ''],
+ 'birthplace' => ['id' => ''],
+ 'birthdate1' => ['id' => ''],
+ 'birthdate2' => ['id' => ''],
+ 'sortby' => ['id' => 'NAME'],
+ 'pageSize' => ['id' => 'A4'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/app/Module/CemeteryReportModuleTest.php b/tests/app/Module/CemeteryReportModuleTest.php
index 13f34ed904..7b8a1dad17 100644
--- a/tests/app/Module/CemeteryReportModuleTest.php
+++ b/tests/app/Module/CemeteryReportModuleTest.php
@@ -17,18 +17,47 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+
/**
* Test harness for the class CemeteryReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class CemeteryReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\CemeteryReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/cemetery_report.xml';
+ $vars = [
+ 'deathplace' => ['id' => ''],
+ 'adlist' => ['id' => 'none'],
+ 'sortby' => ['id' => 'NAME'],
+ 'pageSize' => ['id' => 'A4'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/app/Module/ChangeReportModuleTest.php b/tests/app/Module/ChangeReportModuleTest.php
index 8dbc1eb9af..d4e84d36ba 100644
--- a/tests/app/Module/ChangeReportModuleTest.php
+++ b/tests/app/Module/ChangeReportModuleTest.php
@@ -17,18 +17,50 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+use Illuminate\Support\Carbon;
+
/**
* Test harness for the class ChangeReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class ChangeReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\ChangeReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/change_report.xml';
+ $vars = [
+ 'changeRangeStart' => ['id' => Carbon::now()->subMonths(1)->format('d M Y')],
+ 'changeRangeEnd' => ['id' => Carbon::now()->format('d M Y')],
+ 'pending' => ['id' => 'yes'],
+ 'sortby' => ['id' => 'CHAN'],
+ 'pageSize' => ['id' => 'A4'],
+ 'pageorient' => ['id' => 'landscape'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/app/Module/DeathReportModuleTest.php b/tests/app/Module/DeathReportModuleTest.php
index a856a2951e..f562a57322 100644
--- a/tests/app/Module/DeathReportModuleTest.php
+++ b/tests/app/Module/DeathReportModuleTest.php
@@ -17,18 +17,50 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+
/**
* Test harness for the class DeathReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class DeathReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\DeathReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/death_report.xml';
+ $vars = [
+ 'name' => ['id' => ''],
+ 'deathplace' => ['id' => ''],
+ 'deathdate1' => ['id' => ''],
+ 'deathdate2' => ['id' => ''],
+ 'adlist' => ['id' => 'none'],
+ 'sortby' => ['id' => 'NAME'],
+ 'pageSize' => ['id' => 'A4'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/app/Module/DescendancyReportModuleTest.php b/tests/app/Module/DescendancyReportModuleTest.php
index cec2a53849..d333ed66a4 100644
--- a/tests/app/Module/DescendancyReportModuleTest.php
+++ b/tests/app/Module/DescendancyReportModuleTest.php
@@ -17,18 +17,47 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+
/**
* Test harness for the class DescendancyReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class DescendancyReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\DescendancyReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/descendancy_report.xml';
+ $vars = [
+ 'pid' => ['id' => 'i1'],
+ 'maxgen' => ['id' => '3'],
+ 'sources' => ['id' => 'on'],
+ 'pageSize' => ['id' => 'A4'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/app/Module/FactSourcesReportModuleTest.php b/tests/app/Module/FactSourcesReportModuleTest.php
index 20d8505bbb..3a65d3ed40 100644
--- a/tests/app/Module/FactSourcesReportModuleTest.php
+++ b/tests/app/Module/FactSourcesReportModuleTest.php
@@ -17,18 +17,47 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+
/**
* Test harness for the class FactSourcesReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class FactSourcesReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\FactSourcesReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/fact_sources.xml';
+ $vars = [
+ 'id' => ['id' => 's1'],
+ 'stype' => ['id' => 'facts'],
+ 'sortby' => ['id' => 'BIRT:DATE'],
+ 'pageSize' => ['id' => 'A4'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/app/Module/FamilyGroupReportModuleTest.php b/tests/app/Module/FamilyGroupReportModuleTest.php
index 5f1944d333..370d3e993d 100644
--- a/tests/app/Module/FamilyGroupReportModuleTest.php
+++ b/tests/app/Module/FamilyGroupReportModuleTest.php
@@ -17,18 +17,50 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+
/**
* Test harness for the class FamilyGroupReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class FamilyGroupReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\FamilyGroupReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/family_group_report.xml';
+ $vars = [
+ 'id' => ['id' => 'f1'],
+ 'sources' => ['id' => 'on'],
+ 'notes' => ['id' => 'on'],
+ 'photos' => ['id' => 'on'],
+ 'colors' => ['id' => 'on'],
+ 'blanks' => ['id' => 'on'],
+ 'pageSize' => ['id' => 'A4'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/app/Module/IndividualFamiliesReportModuleTest.php b/tests/app/Module/IndividualFamiliesReportModuleTest.php
index a304394300..839ab352f2 100644
--- a/tests/app/Module/IndividualFamiliesReportModuleTest.php
+++ b/tests/app/Module/IndividualFamiliesReportModuleTest.php
@@ -17,18 +17,52 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+
/**
* Test harness for the class IndividualFamiliesReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class IndividualFamiliesReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\IndividualFamiliesReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/individual_ext_report.xml';
+ $vars = [
+ 'pid' => ['id' => 'i1'],
+ 'relatives' => ['id' => 'child-families'],
+ 'maxgen' => ['id' => '4'],
+ 'sortby' => ['id' => 'BIRT:DATE'],
+ 'sources' => ['id' => 'on'],
+ 'notes' => ['id' => 'on'],
+ 'photos' => ['id' => 'on'],
+ 'pageSize' => ['id' => 'A4'],
+ 'colors' => ['id' => 'on'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/app/Module/IndividualReportModuleTest.php b/tests/app/Module/IndividualReportModuleTest.php
index 5263c205d3..b2c440f3dd 100644
--- a/tests/app/Module/IndividualReportModuleTest.php
+++ b/tests/app/Module/IndividualReportModuleTest.php
@@ -17,18 +17,49 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+
/**
* Test harness for the class IndividualReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class IndividualReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\IndividualReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/individual_report.xml';
+ $vars = [
+ 'id' => ['id' => 'i1'],
+ 'sources' => ['id' => 'on'],
+ 'notes' => ['id' => 'on'],
+ 'photos' => ['id' => 'highlighted'],
+ 'colors' => ['id' => 'on'],
+ 'pageSize' => ['id' => 'A4'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/app/Module/MarriageReportModuleTest.php b/tests/app/Module/MarriageReportModuleTest.php
index 2d1c5a893d..6d038606a6 100644
--- a/tests/app/Module/MarriageReportModuleTest.php
+++ b/tests/app/Module/MarriageReportModuleTest.php
@@ -17,18 +17,49 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+
/**
* Test harness for the class MarriageReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class MarriageReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\MarriageReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/marriage_report.xml';
+ $vars = [
+ 'name' => ['id' => ''],
+ 'marrplace' => ['id' => ''],
+ 'marrdate1' => ['id' => ''],
+ 'marrdate2' => ['id' => ''],
+ 'sortby' => ['id' => 'NAME'],
+ 'pageSize' => ['id' => 'A4'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/app/Module/MissingFactsReportModuleTest.php b/tests/app/Module/MissingFactsReportModuleTest.php
index ed67f50055..88a527ac7b 100644
--- a/tests/app/Module/MissingFactsReportModuleTest.php
+++ b/tests/app/Module/MissingFactsReportModuleTest.php
@@ -17,18 +17,60 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+
/**
* Test harness for the class MissingFactsReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class MissingFactsReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\MissingFactsReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/missing_facts_report.xml';
+ $vars = [
+ 'pid' => ['id' => 'i1'],
+ 'relatives' => ['id' => 'direct-ancestors'],
+ 'maxgen' => ['id' => '*'],
+ 'pageSize' => ['id' => 'A4'],
+ 'sortby' => ['id' => 'NAME'],
+ 'fbirt' => ['id' => 'on'],
+ 'fdeat' => ['id' => 'on'],
+ 'fsour' => ['id' => 'on'],
+ 'fbapm' => ['id' => 'on'],
+ 'fbarm' => ['id' => 'on'],
+ 'fbasm' => ['id' => 'on'],
+ 'fconf' => ['id' => 'on'],
+ 'fenga' => ['id' => 'on'],
+ 'ffcom' => ['id' => 'on'],
+ 'fmarb' => ['id' => 'on'],
+ 'fmarr' => ['id' => 'on'],
+ 'freli' => ['id' => 'on'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/app/Module/OccupationReportModuleTest.php b/tests/app/Module/OccupationReportModuleTest.php
index 3d2c341b44..e7f18ce47b 100644
--- a/tests/app/Module/OccupationReportModuleTest.php
+++ b/tests/app/Module/OccupationReportModuleTest.php
@@ -17,18 +17,46 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+
/**
* Test harness for the class OccupationReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class OccupationReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\OccupationReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/occupation_report.xml';
+ $vars = [
+ 'occupation' => ['id' => 'king'],
+ 'pageSize' => ['id' => 'A4'],
+ 'sortby' => ['id' => 'NAME'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/app/Module/PedigreeReportModuleTest.php b/tests/app/Module/PedigreeReportModuleTest.php
index 0ff6aa5ed2..00a2c23e03 100644
--- a/tests/app/Module/PedigreeReportModuleTest.php
+++ b/tests/app/Module/PedigreeReportModuleTest.php
@@ -17,18 +17,45 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+
/**
* Test harness for the class PedigreeReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class PedigreeReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\PedigreeReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/pedigree_report.xml';
+ $vars = [
+ 'pid' => ['id' => 'i1'],
+ 'orientation' => ['id' => 'portrait'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/app/Module/RelatedIndividualsReportModuleTest.php b/tests/app/Module/RelatedIndividualsReportModuleTest.php
index 4b29943a01..3b8606d6d9 100644
--- a/tests/app/Module/RelatedIndividualsReportModuleTest.php
+++ b/tests/app/Module/RelatedIndividualsReportModuleTest.php
@@ -17,18 +17,52 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Report\ReportHtml;
+use Fisharebest\Webtrees\Report\ReportParserGenerate;
+use Fisharebest\Webtrees\Report\ReportPdf;
+use Fisharebest\Webtrees\Tree;
+
/**
* Test harness for the class RelatedIndividualsReportModule
+ *
+ * @covers \Fisharebest\Webtrees\Report\ReportHtml
+ * @covers \Fisharebest\Webtrees\Report\ReportParserGenerate;
+ * @covers \Fisharebest\Webtrees\Report\ReportPdf;
*/
class RelatedIndividualsReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
+ protected static $uses_database = true;
+
/**
- * Test that the class exists
- *
* @return void
*/
- public function testClassExists(): void
+ public function testReportRunsWithoutError(): void
{
- $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\RelatedIndividualsReportModule'));
+ $tree = $this->importTree('demo.ged');
+ app()->instance(Tree::class, $tree);
+ $xml = WT_ROOT . 'resources/xml/reports/relative_ext_report.xml';
+ $vars = [
+ 'pid' => ['id' => 'i1'],
+ 'relatives' => ['id' => 'child-family'],
+ 'maxgen' => ['id' => '4'],
+ 'sortby' => ['id' => 'BIRT:DATE'],
+ 'sources' => ['id' => 'on'],
+ 'notes' => ['id' => 'on'],
+ 'photos' => ['id' => 'highlighted'],
+ 'colors' => ['id' => 'on'],
+ 'pageSize' => ['id' => 'A4'],
+ ];
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportHtml(), $vars, $tree);
+ $html = ob_get_clean();
+ $this->assertStringStartsWith('<', $html);
+ $this->assertStringEndsWith('>', $html);
+
+ ob_start();
+ new ReportParserGenerate($xml, new ReportPdf(), $vars, $tree);
+ $pdf = ob_get_clean();
+ $this->assertStringStartsWith('%PDF', $pdf);
+ $this->assertStringEndsWith("%%EOF\n", $pdf);
}
}
diff --git a/tests/feature/IndividualListTest.php b/tests/feature/IndividualListTest.php
index 175bc5964c..46af7d23b8 100644
--- a/tests/feature/IndividualListTest.php
+++ b/tests/feature/IndividualListTest.php
@@ -40,9 +40,6 @@ class IndividualListTest extends TestCase
*/
public function testIndividualList(): void
{
- // Needed for Date::display()
- global $tree;
-
$tree = $this->importTree('demo.ged');
$user = Auth::user();
app()->instance(Tree::class, $tree);