. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; use Fisharebest\Webtrees\Services\EmailService; use Fisharebest\Webtrees\Services\TreeService; use Fisharebest\Webtrees\Services\UserService; use Fisharebest\Webtrees\TestCase; /** * Test UserEditActionTest class. * * @covers \Fisharebest\Webtrees\Http\RequestHandlers\UserEditAction */ class UserEditActionTest extends TestCase { protected static $uses_database = true; /** * @return void */ public function testHandler(): void { $mail_service = new EmailService(); $tree_service = new TreeService(); $user_service = new UserService(); $user = $user_service->create('user', 'real', 'email', 'pass'); $handler = new UserEditAction($mail_service, $tree_service, $user_service); $request = self::createRequest(RequestMethodInterface::METHOD_POST, [], [ 'user_id' => $user->id(), 'username' => '', 'real_name' => '', 'email' => '', 'theme' => '', 'password' => '', 'language' => '', 'timezone' => '', 'comment' => '', 'contact-method' => '', 'auto_accept' => '', 'canadmin' => '', 'visible-online' => '', 'verified' => '', 'approved' => '', ]) ->withAttribute('user', $user); $response = $handler->handle($request); self::assertSame(StatusCodeInterface::STATUS_FOUND, $response->getStatusCode()); } }