. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Services; use Fisharebest\Localization\Locale\LocaleEnUs; 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 { $search_service = new SearchService(new LocaleEnUs()); $tree = $this->importTree('demo.ged'); $result = $search_service->searchFamilies([$tree], ['windsor']); $this->assertTrue($result->isNotEmpty()); $result = $search_service->searchFamilyNames([$tree], ['charles', 'diana']); $this->assertTrue($result->isNotEmpty()); $result = $search_service->searchIndividuals([$tree], ['windsor']); $this->assertTrue($result->isNotEmpty()); $result = $search_service->searchIndividualNames([$tree], ['windsor']); $this->assertTrue($result->isNotEmpty()); $result = $search_service->searchMedia([$tree], ['windsor']); $this->assertTrue($result->isNotEmpty()); $result = $search_service->searchNotes([$tree], ['windsor']); $this->assertFalse($result->isNotEmpty()); $result = $search_service->searchRepositories([$tree], ['national']); $this->assertTrue($result->isNotEmpty()); $result = $search_service->searchSources([$tree], ['england']); $this->assertTrue($result->isNotEmpty()); $result = $search_service->searchSourcesByName([$tree], ['england']); $this->assertTrue($result->isNotEmpty()); $result = $search_service->searchSubmitters([$tree], ['greg']); $this->assertTrue($result->isNotEmpty()); $result = $search_service->searchPlaces($tree, 'England'); $this->assertTrue($result->isNotEmpty()); } }