diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2019-01-02 13:28:01 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2019-01-02 13:28:01 +0000 |
| commit | 126654d77c042f1254afcd89fbf831cc610b808e (patch) | |
| tree | dce1b09b197bfbce84ce22af41e5299a49edfbd6 /tests/TestCase.php | |
| parent | 192c8bbfc90bb73951ad7cb8604f80c654abafb2 (diff) | |
| download | webtrees-126654d77c042f1254afcd89fbf831cc610b808e.tar.gz webtrees-126654d77c042f1254afcd89fbf831cc610b808e.tar.bz2 webtrees-126654d77c042f1254afcd89fbf831cc610b808e.zip | |
Use illuminate/database to import trees
Diffstat (limited to 'tests/TestCase.php')
| -rw-r--r-- | tests/TestCase.php | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/TestCase.php b/tests/TestCase.php index 281e9a2d90..6ed6c298f7 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -17,7 +17,9 @@ declare(strict_types=1); namespace Fisharebest\Webtrees; +use Fisharebest\Webtrees\Http\Controllers\GedcomFileController; use Fisharebest\Webtrees\Schema\SeedDatabase; +use Fisharebest\Webtrees\Services\TimeoutService; use Illuminate\Database\Capsule\Manager as DB; use function basename; use function file_get_contents; @@ -118,11 +120,15 @@ class TestCase extends \PHPUnit\Framework\TestCase protected function importTree(string $gedcom_file): Tree { $tree = Tree::create(basename($gedcom_file), basename($gedcom_file)); + $tree->importGedcomFile(__DIR__ . '/../' . $gedcom_file, $gedcom_file); - DB::table('gedcom_chunk')->insert([ - 'gedcom_id' => $tree->id(), - 'chunk_data' => file_get_contents($gedcom_file), - ]); + $gedcom_file_controller = new GedcomFileController(); + + do { + $gedcom_file_controller->import(new TimeoutService(microtime()), $tree); + + $imported = $tree->getPreference('imported'); + } while (!$imported); return $tree; } |
