. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; use Fisharebest\Webtrees\Services\DatatablesService; use Fisharebest\Webtrees\Services\MediaFileService; use Fisharebest\Webtrees\Services\TreeService; use Fisharebest\Webtrees\TestCase; /** * Test ManageMediaData class. * * @covers \Fisharebest\Webtrees\Http\RequestHandlers\ManageMediaData */ class ManageMediaDataTest extends TestCase { protected static $uses_database = true; /** * @return void */ public function testDataLocal(): void { $datatables_service = new DatatablesService(); $media_file_service = new MediaFileService(); $tree_service = new TreeService(); $handler = new ManageMediaData($datatables_service, $media_file_service, $tree_service); $request = self::createRequest(RequestMethodInterface::METHOD_GET, [ 'files' => 'local', 'media_folder' => '', 'subfolders' => 'include', 'search' => ['value' => ''], 'start' => '0', 'length' => '10', ]); $response = $handler->handle($request); self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); } /** * @return void */ public function testDataExternal(): void { $datatables_service = new DatatablesService(); $media_file_service = new MediaFileService(); $tree_service = new TreeService(); $handler = new ManageMediaData($datatables_service, $media_file_service, $tree_service); $request = self::createRequest(RequestMethodInterface::METHOD_GET, [ 'files' => 'local', 'media_folder' => '', 'subfolders' => 'include', 'search' => ['value' => ''], 'start' => '0', 'length' => '10', ]); $response = $handler->handle($request); self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); } /** * @return void */ public function testDataUnused(): void { $datatables_service = new DatatablesService(); $media_file_service = new MediaFileService(); $tree_service = new TreeService(); $handler = new ManageMediaData($datatables_service, $media_file_service, $tree_service); $request = self::createRequest(RequestMethodInterface::METHOD_GET, [ 'files' => 'local', 'media_folder' => '', 'subfolders' => 'include', 'search' => ['value' => ''], 'start' => '0', 'length' => '10', ]); $response = $handler->handle($request); self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); } }