impl. tests and fix validation status code

This commit is contained in:
Dennis Eichhorn 2020-10-06 21:51:40 +02:00
parent fe4f7a60e9
commit 02d41f3140
2 changed files with 20 additions and 14 deletions

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Orange Management * Orange Management
* *
@ -10,6 +11,7 @@
* @version 1.0.0 * @version 1.0.0
* @link https://orange-management.org * @link https://orange-management.org
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace Modules\Comments\Controller; namespace Modules\Comments\Controller;
@ -86,6 +88,7 @@ final class ApiController extends Controller
{ {
if (!empty($val = $this->validateCommentCreate($request))) { if (!empty($val = $this->validateCommentCreate($request))) {
$response->set('news_create', new FormValidation($val)); $response->set('news_create', new FormValidation($val));
$response->getHeader()->setStatusCode(RequestStatusCode::R_400);
return; return;
} }

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Orange Management * Orange Management
* *
@ -10,6 +11,7 @@
* @version 1.0.0 * @version 1.0.0
* @link https://orange-management.org * @link https://orange-management.org
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace Modules\Comments\Controller; namespace Modules\Comments\Controller;
@ -131,6 +133,7 @@ final class BackendController extends Controller
{ {
if (!empty($val = $this->validateCommentCreate($request))) { if (!empty($val = $this->validateCommentCreate($request))) {
$response->set('comment_create', new FormValidation($val)); $response->set('comment_create', new FormValidation($val));
$response->getHeader()->setStatusCode(RequestStatusCode::R_400);
return; return;
} }