Skip to content

Commit

Permalink
Merge pull request #4012 from HungDV2022/unittest_BlogController_captcha
Browse files Browse the repository at this point in the history
BlogController::captcha() ユニットテスト
  • Loading branch information
HungDV2022 authored Nov 12, 2024
2 parents 1665f30 + 9e0e268 commit 303128c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion plugins/bc-blog/src/Controller/BlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

}
12 changes: 5 additions & 7 deletions plugins/bc-blog/tests/TestCase/Controller/BlogControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

}

0 comments on commit 303128c

Please sign in to comment.