diff options
26 files changed, 120 insertions, 138 deletions
diff --git a/app/Validator.php b/app/Validator.php index 06f4fbbca1..f72f454aca 100644 --- a/app/Validator.php +++ b/app/Validator.php @@ -137,7 +137,7 @@ class Validator } /** - * @param array<int|string> $values + * @param array<int|string,int|string> $values * * @return self */ @@ -149,7 +149,7 @@ class Validator } /** - * @param array<string> $values + * @param array<int|string,int|string> $values * * @return self */ diff --git a/composer.json b/composer.json index 529305d998..0c33933336 100644 --- a/composer.json +++ b/composer.json @@ -127,21 +127,13 @@ "~/.composer/vendor/bin/phpcs --colors --extensions=css resources/css" ], "webtrees:phpstan": [ - "@composer global require --quiet phpstan/phpstan=*", - "@composer global require --quiet phpstan/extension-installer=*", - "@composer global require --quiet phpstan/phpstan-deprecation-rules=*", - "@composer global require --quiet phpstan/phpstan-strict-rules=*", - "@composer global require --quiet phpstan/phpstan-phpunit=*", + "@composer global require --quiet phpstan/phpstan=* phpstan/extension-installer=* phpstan/phpstan-deprecation-rules=* phpstan/phpstan-strict-rules=* phpstan/phpstan-phpunit=*", "@composer install --quiet", - "~/.composer/vendor/bin/phpstan analyze --memory-limit=-1 --xdebug --level=max index.php app", + "~/.composer/vendor/bin/phpstan analyze --memory-limit=-1", "@composer install --no-dev --quiet" ], "webtrees:phpstan-baseline": [ - "@composer global require --quiet phpstan/phpstan=*", - "@composer global require --quiet phpstan/extension-installer=*", - "@composer global require --quiet phpstan/phpstan-deprecation-rules=*", - "@composer global require --quiet phpstan/phpstan-strict-rules=*", - "@composer global require --quiet phpstan/phpstan-phpunit=*", + "@composer global require --quiet phpstan/phpstan=* phpstan/extension-installer=* phpstan/phpstan-deprecation-rules=* phpstan/phpstan-strict-rules=* phpstan/phpstan-phpunit=*", "@composer install --quiet", "~/.composer/vendor/bin/phpstan analyze --level=max --generate-baseline=phpstan-baseline.php index.php app", "sed -i -e 's/\\t/ /' phpstan-baseline.php", diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 08c3f33d3a..e71aa9bfb8 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -569,12 +569,12 @@ $ignoreErrors[] = [ 'path' => __DIR__ . '/app/Http/RequestHandlers/ImportThumbnailsData.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'0\' on array\\|false\\.$#', + 'message' => '#^Cannot access offset \'0\' on array\\{0\\: int, 1\\: int, 2\\: int, 3\\: string, mime\\: string, channels\\?\\: int, bits\\?\\: int\\}\\|false\\.$#', 'count' => 1, 'path' => __DIR__ . '/app/Http/RequestHandlers/ManageMediaData.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'1\' on array\\|false\\.$#', + 'message' => '#^Cannot access offset \'1\' on array\\{0\\: int, 1\\: int, 2\\: int, 3\\: string, mime\\: string, channels\\?\\: int, bits\\?\\: int\\}\\|false\\.$#', 'count' => 1, 'path' => __DIR__ . '/app/Http/RequestHandlers/ManageMediaData.php', ]; @@ -2529,12 +2529,12 @@ $ignoreErrors[] = [ 'path' => __DIR__ . '/app/Report/ReportParserGenerate.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot access offset 0 on array\\|false\\.$#', + 'message' => '#^Cannot access offset 0 on array\\{0\\: int, 1\\: int, 2\\: int, 3\\: string, mime\\: string, channels\\?\\: int, bits\\?\\: int\\}\\|false\\.$#', 'count' => 3, 'path' => __DIR__ . '/app/Report/ReportParserGenerate.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot access offset 1 on array\\|false\\.$#', + 'message' => '#^Cannot access offset 1 on array\\{0\\: int, 1\\: int, 2\\: int, 3\\: string, mime\\: string, channels\\?\\: int, bits\\?\\: int\\}\\|false\\.$#', 'count' => 3, 'path' => __DIR__ . '/app/Report/ReportParserGenerate.php', ]; @@ -2844,11 +2844,6 @@ $ignoreErrors[] = [ 'path' => __DIR__ . '/app/Schema/Migration42.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$column of method Illuminate\\\\Database\\\\Query\\\\Builder\\:\\:having\\(\\) expects Closure\\|string, Illuminate\\\\Database\\\\Query\\\\Expression given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/app/Schema/Migration44.php', -]; -$ignoreErrors[] = [ 'message' => '#^Anonymous function should return Fisharebest\\\\Webtrees\\\\Family but returns Fisharebest\\\\Webtrees\\\\Family\\|null\\.$#', 'count' => 1, 'path' => __DIR__ . '/app/Services/AdminService.php', @@ -2894,11 +2889,6 @@ $ignoreErrors[] = [ 'path' => __DIR__ . '/app/Services/AdminService.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$column of method Illuminate\\\\Database\\\\Query\\\\Builder\\:\\:having\\(\\) expects Closure\\|string, Illuminate\\\\Database\\\\Query\\\\Expression given\\.$#', - 'count' => 4, - 'path' => __DIR__ . '/app/Services/AdminService.php', -]; -$ignoreErrors[] = [ 'message' => '#^Parameter \\#1 \\$table of static method Illuminate\\\\Database\\\\Capsule\\\\Manager\\:\\:table\\(\\) expects Closure\\|Illuminate\\\\Database\\\\Query\\\\Builder\\|string, Illuminate\\\\Database\\\\Query\\\\Expression given\\.$#', 'count' => 1, 'path' => __DIR__ . '/app/Services/AdminService.php', @@ -3934,11 +3924,6 @@ $ignoreErrors[] = [ 'path' => __DIR__ . '/app/Statistics/Repository/IndividualRepository.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$column of method Illuminate\\\\Database\\\\Query\\\\Builder\\:\\:having\\(\\) expects Closure\\|string, Illuminate\\\\Database\\\\Query\\\\Expression given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/app/Statistics/Repository/IndividualRepository.php', -]; -$ignoreErrors[] = [ 'message' => '#^Parameter \\#2 \\$callback of function array_walk expects callable\\(int, string\\)\\: mixed, Closure\\(string, string\\)\\: void given\\.$#', 'count' => 1, 'path' => __DIR__ . '/app/Statistics/Repository/IndividualRepository.php', diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 01e896561c..70e0597603 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -2,5 +2,17 @@ includes: - phpstan-baseline.php parameters: + fileExtensions: + - php + - phtml + ignoreErrors: - '#^Access to an undefined property object::\$[A-Za-z0-9_]+\.$#' + + level: max + + paths: + - index.php + - app + - resources/views + - tests diff --git a/resources/views/admin/components.phtml b/resources/views/admin/components.phtml index 2adb651c04..7144722530 100644 --- a/resources/views/admin/components.phtml +++ b/resources/views/admin/components.phtml @@ -17,7 +17,7 @@ use Illuminate\Support\Collection; /** * @var array<string,array<string,string>> $access_summary * @var string $description - * @var string $interface + * @var class-string<ModuleInterface> $interface * @var Collection<int,ModuleInterface> $modules * @var string $title * @var Collection<int,Tree> $trees @@ -189,4 +189,3 @@ use Illuminate\Support\Collection; }); </script> <?php View::endpush() ?> - diff --git a/resources/views/admin/users-edit.phtml b/resources/views/admin/users-edit.phtml index a5976e89f7..da9a2eb221 100644 --- a/resources/views/admin/users-edit.phtml +++ b/resources/views/admin/users-edit.phtml @@ -369,4 +369,3 @@ use Illuminate\Support\Collection; }); </script> <?php View::endpush() ?> - diff --git a/resources/views/edit/raw-gedcom-fact.phtml b/resources/views/edit/raw-gedcom-fact.phtml index 03dfdb88a6..ebeb3d711d 100644 --- a/resources/views/edit/raw-gedcom-fact.phtml +++ b/resources/views/edit/raw-gedcom-fact.phtml @@ -57,4 +57,3 @@ use Fisharebest\Webtrees\Webtrees; webtrees.textareaPatterns(document.getElementById('edit-raw-gedcom')); </script> <?php View::endpush() ?> - diff --git a/resources/views/family-page-parents.phtml b/resources/views/family-page-parents.phtml index 26f31972df..5d50d2d210 100644 --- a/resources/views/family-page-parents.phtml +++ b/resources/views/family-page-parents.phtml @@ -33,7 +33,7 @@ use Fisharebest\Webtrees\Individual; <?php endif ?> </div> - <?= view('family-page-grandparents', ['family' => $family, 'parent_family' => $family?->husband()?->childFamilies()->first(), 'individual' => $family->husband()]) ?> + <?= view('family-page-grandparents', ['family' => $family, 'parent_family' => $family->husband()?->childFamilies()->first(), 'individual' => $family->husband()]) ?> </div> <div class="d-flex"> @@ -55,7 +55,7 @@ use Fisharebest\Webtrees\Individual; <?php endif ?> </div> - <?= view('family-page-grandparents', ['family' => $family, 'parent_family' => $family?->wife()?->childFamilies()->first(), 'individual' => $family->wife()]) ?> + <?= view('family-page-grandparents', ['family' => $family, 'parent_family' => $family->wife()?->childFamilies()->first(), 'individual' => $family->wife()]) ?> </div> </div> </div> diff --git a/tests/TestCase.php b/tests/TestCase.php index e3f2a19c60..bb17428bae 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -139,7 +139,7 @@ class TestCase extends \PHPUnit\Framework\TestCase * @param array<string> $query * @param array<string> $params * @param array<UploadedFileInterface> $files - * @param array<string> $attributes + * @param array<string|Tree> $attributes * * @return ServerRequestInterface */ diff --git a/tests/app/Module/AhnentafelReportModuleTest.php b/tests/app/Module/AhnentafelReportModuleTest.php index 70f93d520c..5ff54529a0 100644 --- a/tests/app/Module/AhnentafelReportModuleTest.php +++ b/tests/app/Module/AhnentafelReportModuleTest.php @@ -25,7 +25,6 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; @@ -74,16 +73,16 @@ class AhnentafelReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); Auth::login($user); $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(AhnentafelReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new AhnentafelReportModule(); + $module->setName('ahnentafel_report'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'pid' => ['id' => 'X1030'], 'maxgen' => ['id' => '3'], 'sources' => ['id' => 'on'], diff --git a/tests/app/Module/BirthDeathMarriageReportModuleTest.php b/tests/app/Module/BirthDeathMarriageReportModuleTest.php index 543f933baf..5571b50851 100644 --- a/tests/app/Module/BirthDeathMarriageReportModuleTest.php +++ b/tests/app/Module/BirthDeathMarriageReportModuleTest.php @@ -23,7 +23,6 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\TestCase; /** @@ -68,12 +67,12 @@ class BirthDeathMarriageReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(BirthDeathMarriageReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new BirthDeathMarriageReportModule(); + $module->setName('bdm_report'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'name' => ['id' => ''], 'bdmplace' => ['id' => ''], 'birthdate1' => ['id' => ''], diff --git a/tests/app/Module/BirthReportModuleTest.php b/tests/app/Module/BirthReportModuleTest.php index bba3d24089..cfb6919700 100644 --- a/tests/app/Module/BirthReportModuleTest.php +++ b/tests/app/Module/BirthReportModuleTest.php @@ -25,10 +25,11 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; +use function ob_get_clean; + /** * Test harness for the class BirthReportModule */ @@ -71,16 +72,16 @@ class BirthReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); Auth::login($user); $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(BirthReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new BirthReportModule(); + $module->setName('birth_report'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'name' => ['id' => ''], 'birthplace' => ['id' => ''], 'birthdate1' => ['id' => ''], diff --git a/tests/app/Module/CemeteryReportModuleTest.php b/tests/app/Module/CemeteryReportModuleTest.php index d6c17ebe0f..51fae08481 100644 --- a/tests/app/Module/CemeteryReportModuleTest.php +++ b/tests/app/Module/CemeteryReportModuleTest.php @@ -25,10 +25,11 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; +use function ob_get_clean; + /** * Test harness for the class CemeteryReportModule */ @@ -71,16 +72,16 @@ class CemeteryReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); Auth::login($user); $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(CemeteryReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new CemeteryReportModule(); + $module->setName('cemetery_report'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'deathplace' => ['id' => ''], 'adlist' => ['id' => 'none'], 'sortby' => ['id' => 'NAME'], diff --git a/tests/app/Module/ChangeReportModuleTest.php b/tests/app/Module/ChangeReportModuleTest.php index 9335053df4..40f09fdcf7 100644 --- a/tests/app/Module/ChangeReportModuleTest.php +++ b/tests/app/Module/ChangeReportModuleTest.php @@ -26,10 +26,11 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; +use function ob_get_clean; + /** * Test harness for the class ChangeReportModule */ @@ -72,16 +73,16 @@ class ChangeReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); Auth::login($user); $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(ChangeReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new ChangeReportModule(); + $module->setName('change_report'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'changeRangeStart' => ['id' => Registry::timestampFactory()->now()->subtractMonths(1)->format('d M Y')], 'changeRangeEnd' => ['id' => Registry::timestampFactory()->now()->format('d M Y')], 'pending' => ['id' => 'yes'], diff --git a/tests/app/Module/DeathReportModuleTest.php b/tests/app/Module/DeathReportModuleTest.php index 6578ffe8f6..a36d4148c7 100644 --- a/tests/app/Module/DeathReportModuleTest.php +++ b/tests/app/Module/DeathReportModuleTest.php @@ -25,10 +25,11 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; +use function ob_get_clean; + /** * Test harness for the class FactSourcesReportModule */ @@ -71,16 +72,16 @@ class DeathReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); Auth::login($user); $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(DeathReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new DeathReportModule(); + $module->setName('death_report'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'name' => ['id' => ''], 'deathplace' => ['id' => ''], 'deathdate1' => ['id' => ''], diff --git a/tests/app/Module/DescendancyReportModuleTest.php b/tests/app/Module/DescendancyReportModuleTest.php index 4c09e16f91..7ae7e0b754 100644 --- a/tests/app/Module/DescendancyReportModuleTest.php +++ b/tests/app/Module/DescendancyReportModuleTest.php @@ -25,7 +25,6 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; @@ -74,16 +73,16 @@ class DescendancyReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); Auth::login($user); $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(DescendancyReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new DescendancyReportModule(); + $module->setName('descendancy_report'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'pid' => ['id' => 'X1030'], 'maxgen' => ['id' => '3'], 'sources' => ['id' => 'on'], diff --git a/tests/app/Module/FactSourcesReportModuleTest.php b/tests/app/Module/FactSourcesReportModuleTest.php index 507fabeeed..2035f6fbc9 100644 --- a/tests/app/Module/FactSourcesReportModuleTest.php +++ b/tests/app/Module/FactSourcesReportModuleTest.php @@ -25,10 +25,11 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; +use function ob_get_clean; + /** * Test harness for the class FactSourcesReportModule */ @@ -71,16 +72,16 @@ class FactSourcesReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); Auth::login($user); $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(FactSourcesReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new FactSourcesReportModule(); + $module->setName('fact_sources'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'id' => ['id' => 's1'], 'stype' => ['id' => 'facts'], 'sortby' => ['id' => 'BIRT:DATE'], diff --git a/tests/app/Module/FamilyGroupReportModuleTest.php b/tests/app/Module/FamilyGroupReportModuleTest.php index 989d7b231f..4e86f36a4d 100644 --- a/tests/app/Module/FamilyGroupReportModuleTest.php +++ b/tests/app/Module/FamilyGroupReportModuleTest.php @@ -25,10 +25,11 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; +use function ob_get_clean; + /** * Test harness for the class FamilyGroupReportModule */ @@ -71,16 +72,16 @@ class FamilyGroupReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); Auth::login($user); $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(FamilyGroupReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new FamilyGroupReportModule(); + $module->setName('family_group_report'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'id' => ['id' => 'f1'], 'sources' => ['id' => 'on'], 'notes' => ['id' => 'on'], diff --git a/tests/app/Module/IndividualFamiliesReportModuleTest.php b/tests/app/Module/IndividualFamiliesReportModuleTest.php index d2304ad2e8..a1971fa929 100644 --- a/tests/app/Module/IndividualFamiliesReportModuleTest.php +++ b/tests/app/Module/IndividualFamiliesReportModuleTest.php @@ -25,7 +25,6 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; @@ -74,16 +73,16 @@ class IndividualFamiliesReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); Auth::login($user); $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(IndividualFamiliesReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new IndividualFamiliesReportModule(); + $module->setName('individual_ext_report'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'pid' => ['id' => 'X1030'], 'relatives' => ['id' => 'child-families'], 'maxgen' => ['id' => '4'], diff --git a/tests/app/Module/IndividualReportModuleTest.php b/tests/app/Module/IndividualReportModuleTest.php index 5c5aa17552..9aa34cf9c2 100644 --- a/tests/app/Module/IndividualReportModuleTest.php +++ b/tests/app/Module/IndividualReportModuleTest.php @@ -25,7 +25,6 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; @@ -71,16 +70,16 @@ class IndividualReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); Auth::login($user); $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(IndividualReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new IndividualReportModule(); + $module->setName('individual_report'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'id' => ['id' => 'X1030'], 'sources' => ['id' => 'on'], 'notes' => ['id' => 'on'], diff --git a/tests/app/Module/MarriageReportModuleTest.php b/tests/app/Module/MarriageReportModuleTest.php index b437839711..99fcdcf2bc 100644 --- a/tests/app/Module/MarriageReportModuleTest.php +++ b/tests/app/Module/MarriageReportModuleTest.php @@ -25,7 +25,6 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; @@ -71,16 +70,16 @@ class MarriageReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); Auth::login($user); $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(MarriageReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new MarriageReportModule(); + $module->setName('marriage_report'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'name' => ['id' => ''], 'marrplace' => ['id' => ''], 'marrdate1' => ['id' => ''], diff --git a/tests/app/Module/MissingFactsReportModuleTest.php b/tests/app/Module/MissingFactsReportModuleTest.php index 72e0df11a0..e87500a411 100644 --- a/tests/app/Module/MissingFactsReportModuleTest.php +++ b/tests/app/Module/MissingFactsReportModuleTest.php @@ -25,7 +25,6 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; @@ -71,16 +70,16 @@ class MissingFactsReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); Auth::login($user); $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(MissingFactsReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new MissingFactsReportModule(); + $module->setName('missing_facts_report'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'pid' => ['id' => 'X1030'], 'relatives' => ['id' => 'direct-ancestors'], 'maxgen' => ['id' => '*'], diff --git a/tests/app/Module/OccupationReportModuleTest.php b/tests/app/Module/OccupationReportModuleTest.php index 1d67d09e71..b54890f74b 100644 --- a/tests/app/Module/OccupationReportModuleTest.php +++ b/tests/app/Module/OccupationReportModuleTest.php @@ -25,7 +25,6 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; @@ -71,16 +70,16 @@ class OccupationReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); Auth::login($user); $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(OccupationReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new OccupationReportModule(); + $module->setName('occupation_report'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'occupation' => ['id' => 'king'], 'pageSize' => ['id' => 'A4'], 'sortby' => ['id' => 'NAME'], diff --git a/tests/app/Module/PedigreeReportModuleTest.php b/tests/app/Module/PedigreeReportModuleTest.php index 7f71f25315..8a13124c45 100644 --- a/tests/app/Module/PedigreeReportModuleTest.php +++ b/tests/app/Module/PedigreeReportModuleTest.php @@ -25,7 +25,6 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; @@ -73,16 +72,16 @@ class PedigreeReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); Auth::login($user); $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(PedigreeReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new PedigreeReportModule(); + $module->setName('pedigree_report'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'pid' => ['id' => 'X1030'], 'spouses' => ['id' => 'on'], 'orientation' => ['id' => 'portrait'], diff --git a/tests/app/Module/RelatedIndividualsReportModuleTest.php b/tests/app/Module/RelatedIndividualsReportModuleTest.php index 6ef19ba7f2..5aa0298118 100644 --- a/tests/app/Module/RelatedIndividualsReportModuleTest.php +++ b/tests/app/Module/RelatedIndividualsReportModuleTest.php @@ -25,7 +25,6 @@ use Fisharebest\Webtrees\Report\HtmlRenderer; use Fisharebest\Webtrees\Report\PdfRenderer; use Fisharebest\Webtrees\Report\ReportParserGenerate; use Fisharebest\Webtrees\Report\ReportParserSetup; -use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; @@ -71,16 +70,16 @@ class RelatedIndividualsReportModuleTest extends TestCase */ public function testReportRunsWithoutError(): void { - $module_service = new ModuleService(); - $user = (new UserService())->create('user', 'User', 'user@example.com', 'secret'); $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); Auth::login($user); $tree = $this->importTree('demo.ged'); - $module = $module_service->findByInterface(RelatedIndividualsReportModule::class)->first(); - $xml = 'resources/' . $module->xmlFilename(); - $vars = [ + $module = new RelatedIndividualsReportModule(); + $module->setName('relative_ext_report'); + + $xml = 'resources/' . $module->xmlFilename(); + $vars = [ 'pid' => ['id' => 'X1030'], 'relatives' => ['id' => 'child-family'], 'maxgen' => ['id' => '4'], diff --git a/tests/views/AbstractViewTest.php b/tests/views/AbstractViewTest.php index c8ec597932..8ec41f7211 100644 --- a/tests/views/AbstractViewTest.php +++ b/tests/views/AbstractViewTest.php @@ -36,7 +36,7 @@ abstract class AbstractViewTest extends TestCase * Check the view runs without error and generates valid HTML * * @param string $view - * @param array<array<string,array<string,mixed>>> $data + * @param array<string,array<int,mixed>> $data */ protected function doTestView(string $view, array $data): void { @@ -48,9 +48,9 @@ abstract class AbstractViewTest extends TestCase } /** - * @param array<string,array<string,mixed>> $input + * @param array<string,array<int,mixed>> $input * - * @return array<array<string,array<string,mixed>>> + * @return array<int,array<string,mixed>> */ private function cartesian(array $input): array { |
