summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2026-02-04 22:05:36 +0000
committerGreg Roach <greg@subaqua.co.uk>2026-02-05 22:43:48 +0000
commitd9775d019d1ca6891650dce04fcc1b243f4c8959 (patch)
treef58652ec37de44d8f86a767c8f2de8071822f605 /tests
parent5c3ef3490523877d6a2bdcd92dc8369607835a26 (diff)
downloadwebtrees-d9775d019d1ca6891650dce04fcc1b243f4c8959.tar.gz
webtrees-d9775d019d1ca6891650dce04fcc1b243f4c8959.tar.bz2
webtrees-d9775d019d1ca6891650dce04fcc1b243f4c8959.zip
Fix: #5277 - missing slideshow images on Postgres; Fix: #4661, Fix: #2355 - missing media on manage media page
Diffstat (limited to 'tests')
-rw-r--r--tests/TestCase.php28
-rw-r--r--tests/feature/ImportGedcomTest.php2
2 files changed, 19 insertions, 11 deletions
diff --git a/tests/TestCase.php b/tests/TestCase.php
index a6815680f7..57057d4210 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -47,6 +47,7 @@ use function filesize;
use function http_build_query;
use function implode;
use function preg_match;
+use function preg_split;
use function str_starts_with;
use function strcspn;
use function strlen;
@@ -176,19 +177,26 @@ class TestCase extends \PHPUnit\Framework\TestCase
$gedcom_import_service = new GedcomImportService();
$tree_service = new TreeService($gedcom_import_service);
$tree = $tree_service->create(basename($gedcom_file), basename($gedcom_file));
- $stream_factory = Registry::container()->get(StreamFactoryInterface::class);
- self::assertInstanceOf(StreamFactoryInterface::class, $stream_factory);
- $stream = $stream_factory->createStreamFromFile(__DIR__ . '/data/' . $gedcom_file);
- $tree_service->importGedcomFile($tree, $stream, $gedcom_file, '');
+ // Creating a new tree will create a header and one individual
+ DB::table('individuals')->where('i_file', '=', $tree->id())->delete();
+ DB::table('families')->where('f_file', '=', $tree->id())->delete();
+ DB::table('sources')->where('s_file', '=', $tree->id())->delete();
+ DB::table('other')->where('o_file', '=', $tree->id())->delete();
+ DB::table('places')->where('p_file', '=', $tree->id())->delete();
+ DB::table('placelinks')->where('pl_file', '=', $tree->id())->delete();
+ DB::table('name')->where('n_file', '=', $tree->id())->delete();
+ DB::table('dates')->where('d_file', '=', $tree->id())->delete();
+ DB::table('change')->where('gedcom_id', '=', $tree->id())->delete();
+ DB::table('link')->where('l_file', '=', $tree->id())->delete();
+ DB::table('media_file')->where('m_file', '=', $tree->id())->delete();
+ DB::table('media')->where('m_file', '=', $tree->id())->delete();
- $timeout_service = new TimeoutService(php_service: new PhpService());
- $controller = new GedcomLoad($gedcom_import_service, $timeout_service);
- $request = self::createRequest()->withAttribute('tree', $tree);
+ $records = preg_split('/\n(?=0)/', file_get_contents(__DIR__ . '/data/' . $gedcom_file));
- do {
- $controller->handle($request);
- } while ($tree->getPreference('imported') !== '1');
+ foreach ($records as $record) {
+ $gedcom_import_service->importRecord($record, $tree, false);
+ }
return $tree;
}
diff --git a/tests/feature/ImportGedcomTest.php b/tests/feature/ImportGedcomTest.php
index b4d3fdfb2c..9434b60f96 100644
--- a/tests/feature/ImportGedcomTest.php
+++ b/tests/feature/ImportGedcomTest.php
@@ -31,6 +31,6 @@ class ImportGedcomTest extends TestCase
{
$tree = $this->importTree('demo.ged');
- self::assertSame('1', $tree->getPreference('imported'));
+ self::assertTrue($tree->imported());
}
}