From cdd04e94ed4fa2e247d6a4415a1b8f8cef0f2cb1 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 26 Apr 2024 19:03:16 +0000 Subject: [PATCH] fix tests --- Controller/ApiController.php | 5 ++++- Theme/Backend/editor-view.tpl.php | 2 +- tests/Controller/ApiControllerTest.php | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 12dc890..686d969 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -234,7 +234,10 @@ final class ApiController extends Controller public function apiEditorUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void { /** @var \Modules\Editor\Models\EditorDoc $old */ - $old = EditorDocMapper::get()->where('id', (int) $request->getData('id'))->execute(); + $old = EditorDocMapper::get() + ->where('id', (int) $request->getData('id')) + ->execute(); + $new = $this->updateEditorFromRequest($request, clone $old); $this->updateModel($request->header->account, $old, $new, EditorDocMapper::class, 'doc', $request->getOrigin()); diff --git a/Theme/Backend/editor-view.tpl.php b/Theme/Backend/editor-view.tpl.php index 4b0a700..e19bf0e 100644 --- a/Theme/Backend/editor-view.tpl.php +++ b/Theme/Backend/editor-view.tpl.php @@ -50,7 +50,7 @@ echo $this->data['nav']->render(); ?>
- getHtml('Edit', '0', '0'); ?> + getHtml('Edit', '0', '0'); ?>
diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index 318cc9e..774aaf0 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -209,6 +209,8 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase $this->module->apiEditorUpdate($request, $response); + var_dump(EditorDocMapper::get()->where('id', 1)->execute()); + self::assertEquals('Changed Title', $response->getDataArray('')['response']->title); self::assertEquals('Changed Title', EditorDocMapper::get()->where('id', 1)->execute()->title); self::assertEquals(1, $response->getDataArray('')['response']->id);