summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-04-13 22:01:36 +0100
committerGreg Roach <fisharebest@webtrees.net>2019-04-14 09:39:45 +0100
commitf397d0fdeebb0d5a9590d5ba2d4d2aae8df09df1 (patch)
tree79dcc330a46550fe2e33f2a802bddea724649584 /tests
parenta22c26f33a8f68ef90ed22483c6c4afd351939be (diff)
downloadwebtrees-f397d0fdeebb0d5a9590d5ba2d4d2aae8df09df1.tar.gz
webtrees-f397d0fdeebb0d5a9590d5ba2d4d2aae8df09df1.tar.bz2
webtrees-f397d0fdeebb0d5a9590d5ba2d4d2aae8df09df1.zip
Refactor the bootstrap process
Diffstat (limited to 'tests')
-rw-r--r--tests/TestCase.php5
-rw-r--r--tests/app/Module/AhnentafelReportModuleTest.php3
-rw-r--r--tests/app/Module/BirthDeathMarriageReportModuleTest.php3
-rw-r--r--tests/app/Module/BirthReportModuleTest.php3
-rw-r--r--tests/app/Module/CemeteryReportModuleTest.php3
-rw-r--r--tests/app/Module/ChangeReportModuleTest.php3
-rw-r--r--tests/app/Module/DeathReportModuleTest.php3
-rw-r--r--tests/app/Module/DescendancyReportModuleTest.php3
-rw-r--r--tests/app/Module/FactSourcesReportModuleTest.php3
-rw-r--r--tests/app/Module/FamilyGroupReportModuleTest.php3
-rw-r--r--tests/app/Module/IndividualFamiliesReportModuleTest.php3
-rw-r--r--tests/app/Module/IndividualReportModuleTest.php3
-rw-r--r--tests/app/Module/MarriageReportModuleTest.php3
-rw-r--r--tests/app/Module/MissingFactsReportModuleTest.php3
-rw-r--r--tests/app/Module/OccupationReportModuleTest.php3
-rw-r--r--tests/app/Module/PedigreeReportModuleTest.php3
-rw-r--r--tests/app/Module/RelatedIndividualsReportModuleTest.php3
-rw-r--r--tests/app/WebtreesTest.php15
18 files changed, 39 insertions, 29 deletions
diff --git a/tests/TestCase.php b/tests/TestCase.php
index b110d08882..190acb685a 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -88,14 +88,11 @@ class TestCase extends \PHPUnit\Framework\TestCase implements StatusCodeInterfac
app()->bind(ModuleThemeInterface::class, WebtreesTheme::class);
app()->bind(LocaleInterface::class, LocaleEnUs::class);
- 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_DATA_DIR') || define('WT_DATA_DIR', Webtrees::ROOT_DIR . 'data/');
defined('WT_LOCALE') || define('WT_LOCALE', I18N::init('en-US', null, true));
if (static::$uses_database) {
- defined('WT_ROOT') || define('WT_ROOT', dirname(__DIR__) . '/');
-
static::createTestDatabase();
}
}
diff --git a/tests/app/Module/AhnentafelReportModuleTest.php b/tests/app/Module/AhnentafelReportModuleTest.php
index 7567a795bc..5ba73b6f38 100644
--- a/tests/app/Module/AhnentafelReportModuleTest.php
+++ b/tests/app/Module/AhnentafelReportModuleTest.php
@@ -23,6 +23,7 @@ use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
/**
* Test harness for the class AhnentafelReportModule
@@ -78,7 +79,7 @@ class AhnentafelReportModuleTest extends \Fisharebest\Webtrees\TestCase
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/ahnentafel_report.xml';
+ $xml = Webtrees::ROOT_DIR . 'resources/xml/reports/ahnentafel_report.xml';
$vars = [
'pid' => ['id' => 'X1030'],
'maxgen' => ['id' => '3'],
diff --git a/tests/app/Module/BirthDeathMarriageReportModuleTest.php b/tests/app/Module/BirthDeathMarriageReportModuleTest.php
index 26d59bb2b3..8ef5cfd9a9 100644
--- a/tests/app/Module/BirthDeathMarriageReportModuleTest.php
+++ b/tests/app/Module/BirthDeathMarriageReportModuleTest.php
@@ -21,6 +21,7 @@ use Fisharebest\Webtrees\Report\ReportHtml;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
/**
* Test harness for the class BirthDeathMarriageReportModule
@@ -72,7 +73,7 @@ class BirthDeathMarriageReportModuleTest extends \Fisharebest\Webtrees\TestCase
{
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/bdm_report.xml';
+ $xml = Webtrees::ROOT_DIR . 'resources/xml/reports/bdm_report.xml';
$vars = [
'name' => ['id' => ''],
'bdmplace' => ['id' => ''],
diff --git a/tests/app/Module/BirthReportModuleTest.php b/tests/app/Module/BirthReportModuleTest.php
index 22d8950267..d4b731228d 100644
--- a/tests/app/Module/BirthReportModuleTest.php
+++ b/tests/app/Module/BirthReportModuleTest.php
@@ -23,6 +23,7 @@ use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
/**
* Test harness for the class BirthReportModule
@@ -78,7 +79,7 @@ class BirthReportModuleTest extends \Fisharebest\Webtrees\TestCase
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/birth_report.xml';
+ $xml = Webtrees::ROOT_DIR . 'resources/xml/reports/birth_report.xml';
$vars = [
'name' => ['id' => ''],
'birthplace' => ['id' => ''],
diff --git a/tests/app/Module/CemeteryReportModuleTest.php b/tests/app/Module/CemeteryReportModuleTest.php
index 38195bc092..9ca83fd41c 100644
--- a/tests/app/Module/CemeteryReportModuleTest.php
+++ b/tests/app/Module/CemeteryReportModuleTest.php
@@ -23,6 +23,7 @@ use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
/**
* Test harness for the class CemeteryReportModule
@@ -78,7 +79,7 @@ class CemeteryReportModuleTest extends \Fisharebest\Webtrees\TestCase
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/cemetery_report.xml';
+ $xml = Webtrees::ROOT_DIR . 'resources/xml/reports/cemetery_report.xml';
$vars = [
'deathplace' => ['id' => ''],
'adlist' => ['id' => 'none'],
diff --git a/tests/app/Module/ChangeReportModuleTest.php b/tests/app/Module/ChangeReportModuleTest.php
index ff7ebd3a49..d0ce71a2ad 100644
--- a/tests/app/Module/ChangeReportModuleTest.php
+++ b/tests/app/Module/ChangeReportModuleTest.php
@@ -23,6 +23,7 @@ use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
use Illuminate\Support\Carbon;
/**
@@ -79,7 +80,7 @@ class ChangeReportModuleTest extends \Fisharebest\Webtrees\TestCase
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/change_report.xml';
+ $xml = Webtrees::ROOT_DIR . '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')],
diff --git a/tests/app/Module/DeathReportModuleTest.php b/tests/app/Module/DeathReportModuleTest.php
index cc9ddb9022..bdf01bf6ab 100644
--- a/tests/app/Module/DeathReportModuleTest.php
+++ b/tests/app/Module/DeathReportModuleTest.php
@@ -23,6 +23,7 @@ use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
/**
* Test harness for the class FactSourcesReportModule
@@ -78,7 +79,7 @@ class DeathReportModuleTest extends \Fisharebest\Webtrees\TestCase
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/death_report.xml';
+ $xml = Webtrees::ROOT_DIR . 'resources/xml/reports/death_report.xml';
$vars = [
'name' => ['id' => ''],
'deathplace' => ['id' => ''],
diff --git a/tests/app/Module/DescendancyReportModuleTest.php b/tests/app/Module/DescendancyReportModuleTest.php
index 1b9f1a241d..9662b1560b 100644
--- a/tests/app/Module/DescendancyReportModuleTest.php
+++ b/tests/app/Module/DescendancyReportModuleTest.php
@@ -23,6 +23,7 @@ use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
/**
* Test harness for the class DescendancyReportModule
@@ -78,7 +79,7 @@ class DescendancyReportModuleTest extends \Fisharebest\Webtrees\TestCase
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/descendancy_report.xml';
+ $xml = Webtrees::ROOT_DIR . 'resources/xml/reports/descendancy_report.xml';
$vars = [
'pid' => ['id' => 'X1030'],
'maxgen' => ['id' => '3'],
diff --git a/tests/app/Module/FactSourcesReportModuleTest.php b/tests/app/Module/FactSourcesReportModuleTest.php
index 904162c3fd..32b5bded02 100644
--- a/tests/app/Module/FactSourcesReportModuleTest.php
+++ b/tests/app/Module/FactSourcesReportModuleTest.php
@@ -23,6 +23,7 @@ use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
/**
* Test harness for the class FactSourcesReportModule
@@ -78,7 +79,7 @@ class FactSourcesReportModuleTest extends \Fisharebest\Webtrees\TestCase
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/fact_sources.xml';
+ $xml = Webtrees::ROOT_DIR . 'resources/xml/reports/fact_sources.xml';
$vars = [
'id' => ['id' => 's1'],
'stype' => ['id' => 'facts'],
diff --git a/tests/app/Module/FamilyGroupReportModuleTest.php b/tests/app/Module/FamilyGroupReportModuleTest.php
index d2a5d26119..5b286a22b8 100644
--- a/tests/app/Module/FamilyGroupReportModuleTest.php
+++ b/tests/app/Module/FamilyGroupReportModuleTest.php
@@ -23,6 +23,7 @@ use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
/**
* Test harness for the class FamilyGroupReportModule
@@ -78,7 +79,7 @@ class FamilyGroupReportModuleTest extends \Fisharebest\Webtrees\TestCase
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/family_group_report.xml';
+ $xml = Webtrees::ROOT_DIR . 'resources/xml/reports/family_group_report.xml';
$vars = [
'id' => ['id' => 'f1'],
'sources' => ['id' => 'on'],
diff --git a/tests/app/Module/IndividualFamiliesReportModuleTest.php b/tests/app/Module/IndividualFamiliesReportModuleTest.php
index 50a61e3778..3ea62af057 100644
--- a/tests/app/Module/IndividualFamiliesReportModuleTest.php
+++ b/tests/app/Module/IndividualFamiliesReportModuleTest.php
@@ -23,6 +23,7 @@ use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
/**
* Test harness for the class IndividualFamiliesReportModule
@@ -78,7 +79,7 @@ class IndividualFamiliesReportModuleTest extends \Fisharebest\Webtrees\TestCase
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/individual_ext_report.xml';
+ $xml = Webtrees::ROOT_DIR . 'resources/xml/reports/individual_ext_report.xml';
$vars = [
'pid' => ['id' => 'X1030'],
'relatives' => ['id' => 'child-families'],
diff --git a/tests/app/Module/IndividualReportModuleTest.php b/tests/app/Module/IndividualReportModuleTest.php
index 713850d888..eba24b5eb7 100644
--- a/tests/app/Module/IndividualReportModuleTest.php
+++ b/tests/app/Module/IndividualReportModuleTest.php
@@ -23,6 +23,7 @@ use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
/**
* Test harness for the class IndividualReportModule
@@ -79,7 +80,7 @@ class IndividualReportModuleTest extends \Fisharebest\Webtrees\TestCase
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/individual_report.xml';
+ $xml = Webtrees::ROOT_DIR . 'resources/xml/reports/individual_report.xml';
$vars = [
'id' => ['id' => 'X1030'],
'sources' => ['id' => 'on'],
diff --git a/tests/app/Module/MarriageReportModuleTest.php b/tests/app/Module/MarriageReportModuleTest.php
index 4aaf1688c7..ed3f3e658e 100644
--- a/tests/app/Module/MarriageReportModuleTest.php
+++ b/tests/app/Module/MarriageReportModuleTest.php
@@ -23,6 +23,7 @@ use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
/**
* Test harness for the class MarriageReportModule
@@ -78,7 +79,7 @@ class MarriageReportModuleTest extends \Fisharebest\Webtrees\TestCase
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/marriage_report.xml';
+ $xml = Webtrees::ROOT_DIR . 'resources/xml/reports/marriage_report.xml';
$vars = [
'name' => ['id' => ''],
'marrplace' => ['id' => ''],
diff --git a/tests/app/Module/MissingFactsReportModuleTest.php b/tests/app/Module/MissingFactsReportModuleTest.php
index a7b248985c..7fa20574ff 100644
--- a/tests/app/Module/MissingFactsReportModuleTest.php
+++ b/tests/app/Module/MissingFactsReportModuleTest.php
@@ -23,6 +23,7 @@ use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
/**
* Test harness for the class MissingFactsReportModule
@@ -78,7 +79,7 @@ class MissingFactsReportModuleTest extends \Fisharebest\Webtrees\TestCase
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/missing_facts_report.xml';
+ $xml = Webtrees::ROOT_DIR . 'resources/xml/reports/missing_facts_report.xml';
$vars = [
'pid' => ['id' => 'X1030'],
'relatives' => ['id' => 'direct-ancestors'],
diff --git a/tests/app/Module/OccupationReportModuleTest.php b/tests/app/Module/OccupationReportModuleTest.php
index c86c10ff80..bfd710a017 100644
--- a/tests/app/Module/OccupationReportModuleTest.php
+++ b/tests/app/Module/OccupationReportModuleTest.php
@@ -23,6 +23,7 @@ use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
/**
* Test harness for the class OccupationReportModule
@@ -78,7 +79,7 @@ class OccupationReportModuleTest extends \Fisharebest\Webtrees\TestCase
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/occupation_report.xml';
+ $xml = Webtrees::ROOT_DIR . 'resources/xml/reports/occupation_report.xml';
$vars = [
'occupation' => ['id' => 'king'],
'pageSize' => ['id' => 'A4'],
diff --git a/tests/app/Module/PedigreeReportModuleTest.php b/tests/app/Module/PedigreeReportModuleTest.php
index 5ea92b82b5..d074cb732f 100644
--- a/tests/app/Module/PedigreeReportModuleTest.php
+++ b/tests/app/Module/PedigreeReportModuleTest.php
@@ -23,6 +23,7 @@ use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
/**
* Test harness for the class PedigreeReportModule
@@ -78,7 +79,7 @@ class PedigreeReportModuleTest extends \Fisharebest\Webtrees\TestCase
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/pedigree_report.xml';
+ $xml = Webtrees::ROOT_DIR . 'resources/xml/reports/pedigree_report.xml';
$vars = [
'pid' => ['id' => 'X1030'],
'spouses' => ['id' => 'on'],
diff --git a/tests/app/Module/RelatedIndividualsReportModuleTest.php b/tests/app/Module/RelatedIndividualsReportModuleTest.php
index 1bfff18829..8b467f0b57 100644
--- a/tests/app/Module/RelatedIndividualsReportModuleTest.php
+++ b/tests/app/Module/RelatedIndividualsReportModuleTest.php
@@ -23,6 +23,7 @@ use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportPdf;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
+use Fisharebest\Webtrees\Webtrees;
/**
* Test harness for the class RelatedIndividualsReportModule
@@ -78,7 +79,7 @@ class RelatedIndividualsReportModuleTest extends \Fisharebest\Webtrees\TestCase
$tree = $this->importTree('demo.ged');
app()->instance(Tree::class, $tree);
- $xml = WT_ROOT . 'resources/xml/reports/relative_ext_report.xml';
+ $xml = Webtrees::ROOT_DIR . 'resources/xml/reports/relative_ext_report.xml';
$vars = [
'pid' => ['id' => 'X1030'],
'relatives' => ['id' => 'child-family'],
diff --git a/tests/app/WebtreesTest.php b/tests/app/WebtreesTest.php
index 68d51afcd7..a075ac742a 100644
--- a/tests/app/WebtreesTest.php
+++ b/tests/app/WebtreesTest.php
@@ -17,10 +17,10 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees;
+use ErrorException;
use function date_default_timezone_get;
use function date_default_timezone_set;
use function error_reporting;
-use ErrorException;
use function set_error_handler;
/**
@@ -29,19 +29,16 @@ use function set_error_handler;
class WebtreesTest extends TestCase
{
/**
- * @covers \Fisharebest\Webtrees\Webtrees::init
+ * @covers \Fisharebest\Webtrees\Webtrees::bootstrap
* @return void
*/
public function testInit(): void
{
- date_default_timezone_set('Europe/London');
error_reporting(0);
set_error_handler(null);
- Webtrees::init();
-
- // webtrees always runs in UTC (and converts to local time on demand).
- $this->assertSame('UTC', date_default_timezone_get());
+ $webtrees = new Webtrees();
+ $webtrees->bootstrap();
// webtrees sets the error reporting level.
$this->assertNotSame(0, error_reporting());
@@ -49,13 +46,13 @@ class WebtreesTest extends TestCase
try {
// Trigger an error
- fopen(__DIR__ . '/no-such-file', 'r');
+ fopen(__DIR__ . '/no-such-file', 'rb');
} catch (ErrorException $ex) {
$this->assertSame(__FILE__, $ex->getFile());
}
// Disable error reporting (we could use "@"), and don't raise an exception.
error_reporting(0);
- fopen(__DIR__ . '/no-such-file', 'r');
+ fopen(__DIR__ . '/no-such-file', 'rb');
}
}