From 9e0e26810aedb781c410d09a43b692bb61e13699 Mon Sep 17 00:00:00 2001 From: TPGF00003 Date: Tue, 12 Nov 2024 11:58:29 +0900 Subject: [PATCH] =?UTF-8?q?BlogController::captcha()=20=E3=83=A6=E3=83=8B?= =?UTF-8?q?=E3=83=83=E3=83=88=E3=83=86=E3=82=B9=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/bc-blog/src/Controller/BlogController.php | 2 +- .../tests/TestCase/Controller/BlogControllerTest.php | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/plugins/bc-blog/src/Controller/BlogController.php b/plugins/bc-blog/src/Controller/BlogController.php index cb9a1fe39c..abbfd60939 100755 --- a/plugins/bc-blog/src/Controller/BlogController.php +++ b/plugins/bc-blog/src/Controller/BlogController.php @@ -371,12 +371,12 @@ public function ajax_add_comment(BlogCommentsServiceInterface $service, BcCaptch * @return void * @checked * @noTodo + * @unitTest */ public function captcha(BcCaptchaServiceInterface $service, string $token) { $this->viewBuilder()->disableAutoLayout(); $service->render($this->getRequest(), $token); - exit(); } } diff --git a/plugins/bc-blog/tests/TestCase/Controller/BlogControllerTest.php b/plugins/bc-blog/tests/TestCase/Controller/BlogControllerTest.php index e37a8622f4..58da91453b 100755 --- a/plugins/bc-blog/tests/TestCase/Controller/BlogControllerTest.php +++ b/plugins/bc-blog/tests/TestCase/Controller/BlogControllerTest.php @@ -373,14 +373,12 @@ public function test_ajax_add_comment() */ public function test_captcha() { - $this->markTestIncomplete('このテストはまだ実装されていません。'); - //準備 - - //正常系実行 - - //異常系実行 - + $this->loadFixtureScenario(InitAppScenario::class); + ContentFactory::make(['url' => '/news/', 'site_id' => 1, 'entity_id' => 1, 'plugin' => 'BcBlog', 'type' => 'BlogContent',])->persist(); + ob_start(); + $this->get('/news/captcha/abc'); + $this->assertNotNull(ob_get_clean()); } }