1a7a24840SGreg Roach<?php 23976b470SGreg Roach 3a7a24840SGreg Roach/** 4a7a24840SGreg Roach * webtrees: online genealogy 5*89f7189bSGreg Roach * Copyright (C) 2021 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 15*89f7189bSGreg 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; 24a7a24840SGreg Roach 25a7a24840SGreg Roach/** 26a7a24840SGreg Roach * Test harness for the class SearchService 27a7a24840SGreg Roach * 28a7a24840SGreg Roach * @covers \Fisharebest\Webtrees\Services\SearchService 29a7a24840SGreg Roach */ 30a7a24840SGreg Roachclass SearchServiceTest extends TestCase 31a7a24840SGreg Roach{ 32a7a24840SGreg Roach protected static $uses_database = true; 33a7a24840SGreg Roach 34a7a24840SGreg Roach /** 35a7a24840SGreg Roach * @return void 36a7a24840SGreg Roach */ 37a7a24840SGreg Roach public function testSearchesReturnCollections(): void 38a7a24840SGreg Roach { 39d5ad3db0SGreg Roach $tree_service = new TreeService(); 40d5ad3db0SGreg Roach $search_service = new SearchService($tree_service); 41a7a24840SGreg Roach $tree = $this->importTree('demo.ged'); 42a7a24840SGreg Roach 43f83e5039SGreg Roach $result = $search_service->searchFamilies([$tree], ['windsor']); 445e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 45a7a24840SGreg Roach 46e3bddf11SGreg Roach $result = $search_service->searchFamilyNames([$tree], ['charles', 'diana']); 475e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 48a7a24840SGreg Roach 49f83e5039SGreg Roach $result = $search_service->searchIndividuals([$tree], ['windsor']); 505e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 51a7a24840SGreg Roach 52f83e5039SGreg Roach $result = $search_service->searchIndividualNames([$tree], ['windsor']); 535e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 54a7a24840SGreg Roach 55f83e5039SGreg Roach $result = $search_service->searchMedia([$tree], ['windsor']); 565e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 57a7a24840SGreg Roach 58f83e5039SGreg Roach $result = $search_service->searchNotes([$tree], ['windsor']); 595e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 60a7a24840SGreg Roach 61e3bddf11SGreg Roach $result = $search_service->searchRepositories([$tree], ['national']); 625e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 63a7a24840SGreg Roach 64e3bddf11SGreg Roach $result = $search_service->searchSources([$tree], ['england']); 655e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 66a7a24840SGreg Roach 67e3bddf11SGreg Roach $result = $search_service->searchSourcesByName([$tree], ['england']); 685e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 69a7a24840SGreg Roach 70e3bddf11SGreg Roach $result = $search_service->searchSubmitters([$tree], ['greg']); 715e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 72f83e5039SGreg Roach 73f83e5039SGreg Roach $result = $search_service->searchPlaces($tree, 'England'); 745e933c21SGreg Roach self::assertInstanceOf(Collection::class, $result); 75a7a24840SGreg Roach } 76a7a24840SGreg Roach} 77