. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Services; use Fisharebest\Webtrees\TestCase; use Illuminate\Support\Collection; /** * Test harness for the class SearchService * * @covers \Fisharebest\Webtrees\Services\SearchService */ class SearchServiceTest extends TestCase { protected static $uses_database = true; /** * @return void */ public function testSearchesReturnCollections(): void { $tree_service = new TreeService(); $search_service = new SearchService($tree_service); $tree = $this->importTree('demo.ged'); $result = $search_service->searchFamilies([$tree], ['windsor']); self::assertInstanceOf(Collection::class, $result); $result = $search_service->searchFamilyNames([$tree], ['charles', 'diana']); self::assertInstanceOf(Collection::class, $result); $result = $search_service->searchIndividuals([$tree], ['windsor']); self::assertInstanceOf(Collection::class, $result); $result = $search_service->searchIndividualNames([$tree], ['windsor']); self::assertInstanceOf(Collection::class, $result); $result = $search_service->searchMedia([$tree], ['windsor']); self::assertInstanceOf(Collection::class, $result); $result = $search_service->searchNotes([$tree], ['windsor']); self::assertInstanceOf(Collection::class, $result); $result = $search_service->searchRepositories([$tree], ['national']); self::assertInstanceOf(Collection::class, $result); $result = $search_service->searchSources([$tree], ['england']); self::assertInstanceOf(Collection::class, $result); $result = $search_service->searchSourcesByName([$tree], ['england']); self::assertInstanceOf(Collection::class, $result); $result = $search_service->searchSubmitters([$tree], ['greg']); self::assertInstanceOf(Collection::class, $result); $result = $search_service->searchPlaces($tree, 'England'); self::assertInstanceOf(Collection::class, $result); } }