summaryrefslogtreecommitdiff
path: root/tests/app
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-03-14 23:12:58 +0000
committerGreg Roach <fisharebest@webtrees.net>2019-03-15 12:35:14 +0000
commit9a3accd78795046143d5b995599032fcff82a467 (patch)
treed15b2760a2afb94a37b292a677a3770fc5c7563c /tests/app
parentaf14d23858d0cfa8a319c6c50a5f28fbc7754829 (diff)
downloadwebtrees-9a3accd78795046143d5b995599032fcff82a467.tar.gz
webtrees-9a3accd78795046143d5b995599032fcff82a467.tar.bz2
webtrees-9a3accd78795046143d5b995599032fcff82a467.zip
Tests
Diffstat (limited to 'tests/app')
-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
16 files changed, 571 insertions, 64 deletions
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);
}
}