. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Services\DataFixService; use Fisharebest\Webtrees\Services\DatatablesService; use Fisharebest\Webtrees\Services\GedcomImportService; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Services\TreeService; use Fisharebest\Webtrees\TestCase; /** * Test DataFixDataTest class. * * @covers \Fisharebest\Webtrees\Http\RequestHandlers\DataFixData * @covers \Fisharebest\Webtrees\Module\FixSearchAndReplace */ class DataFixDataTest extends TestCase { protected static bool $uses_database = true; /** * Test request handler */ public function testHandlerForFixSearchAndReplace(): void { $gedcom_import_service = new GedcomImportService(); $tree_service = new TreeService($gedcom_import_service); $tree = $tree_service->create('name', 'title'); $data_fix_service = new DataFixService(); $datatables_service = new DatatablesService(); $module_service = new ModuleService(); $handler = new DataFixData($data_fix_service, $datatables_service, $module_service); $request = self::createRequest(RequestMethodInterface::METHOD_GET, [ 'type' => Individual::RECORD_TYPE, 'search' => 'DOE', 'method' => 'exact', 'case' => '' ]) ->withAttribute('tree', $tree) ->withAttribute('data_fix', 'fix-search-and-replace'); $response = $handler->handle($request); self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); } }