1a7a24840SGreg Roach<?php 23976b470SGreg Roach 3a7a24840SGreg Roach/** 4a7a24840SGreg Roach * webtrees: online genealogy 5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 6a7a24840SGreg Roach * This program is free software: you can redistribute it and/or modify 7a7a24840SGreg Roach * it under the terms of the GNU General Public License as published by 8a7a24840SGreg Roach * the Free Software Foundation, either version 3 of the License, or 9a7a24840SGreg Roach * (at your option) any later version. 10a7a24840SGreg Roach * This program is distributed in the hope that it will be useful, 11a7a24840SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12a7a24840SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13a7a24840SGreg Roach * GNU General Public License for more details. 14a7a24840SGreg Roach * You should have received a copy of the GNU General Public License 1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 16a7a24840SGreg Roach */ 17fcfa147eSGreg Roach 18a7a24840SGreg Roachdeclare(strict_types=1); 19a7a24840SGreg Roach 20a7a24840SGreg Roachnamespace Fisharebest\Webtrees\Services; 21a7a24840SGreg Roach 22a7a24840SGreg Roachuse Fisharebest\Webtrees\TestCase; 23a7a24840SGreg Roachuse Illuminate\Support\Collection; 24*202c018bSGreg Roachuse PHPUnit\Framework\Attributes\CoversClass; 25a7a24840SGreg Roach 26*202c018bSGreg Roach#[CoversClass(SearchService::class)] 27a7a24840SGreg Roachclass SearchServiceTest extends TestCase 28a7a24840SGreg Roach{ 29cd94ca66SGreg Roach protected static bool $uses_database = true; 30a7a24840SGreg Roach 31a7a24840SGreg Roach public function testSearchesReturnCollections(): void 32a7a24840SGreg Roach { 332c685d76SGreg Roach $tree_service = new TreeService(new GedcomImportService()); 34d5ad3db0SGreg Roach $search_service = new SearchService($tree_service); 35a7a24840SGreg Roach $tree = $this->importTree('demo.ged'); 36a7a24840SGreg Roach 37f83e5039SGreg Roach $result = $search_service->searchFamilies([$tree], ['windsor']); 385e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 39a7a24840SGreg Roach 40e3bddf11SGreg Roach $result = $search_service->searchFamilyNames([$tree], ['charles', 'diana']); 415e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 42a7a24840SGreg Roach 43f83e5039SGreg Roach $result = $search_service->searchIndividuals([$tree], ['windsor']); 445e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 45a7a24840SGreg Roach 46f83e5039SGreg Roach $result = $search_service->searchIndividualNames([$tree], ['windsor']); 475e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 48a7a24840SGreg Roach 49f83e5039SGreg Roach $result = $search_service->searchMedia([$tree], ['windsor']); 505e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 51a7a24840SGreg Roach 52f83e5039SGreg Roach $result = $search_service->searchNotes([$tree], ['windsor']); 535e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 54a7a24840SGreg Roach 55e3bddf11SGreg Roach $result = $search_service->searchRepositories([$tree], ['national']); 565e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 57a7a24840SGreg Roach 58e3bddf11SGreg Roach $result = $search_service->searchSources([$tree], ['england']); 595e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 60a7a24840SGreg Roach 61e3bddf11SGreg Roach $result = $search_service->searchSourcesByName([$tree], ['england']); 625e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 63a7a24840SGreg Roach 64e3bddf11SGreg Roach $result = $search_service->searchSubmitters([$tree], ['greg']); 655e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 66f83e5039SGreg Roach 67f83e5039SGreg Roach $result = $search_service->searchPlaces($tree, 'England'); 685e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 69a7a24840SGreg Roach } 70a7a24840SGreg Roach} 71