. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Services; use Fisharebest\Webtrees\TestCase; use Illuminate\Support\Collection; use PHPUnit\Framework\Attributes\CoversClass; #[CoversClass(SearchService::class)] class SearchServiceTest extends TestCase { protected static bool $uses_database = true; public function testSearchesReturnCollections(): void { $tree_service = new TreeService(new GedcomImportService()); $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); } }