From 03d2cf654e883dcb7f9dc3e161380d83db06494a Mon Sep 17 00:00:00 2001 From: TPGF00003 Date: Tue, 12 Nov 2024 11:53:42 +0900 Subject: [PATCH] =?UTF-8?q?MailController::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-mail/src/Controller/MailController.php | 2 +- .../tests/TestCase/Controller/MailControllerTest.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/bc-mail/src/Controller/MailController.php b/plugins/bc-mail/src/Controller/MailController.php index 70828acd8c..d58879b444 100755 --- a/plugins/bc-mail/src/Controller/MailController.php +++ b/plugins/bc-mail/src/Controller/MailController.php @@ -353,12 +353,12 @@ public function thanks(MailFrontServiceInterface $service, MailContentsServiceIn * @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-mail/tests/TestCase/Controller/MailControllerTest.php b/plugins/bc-mail/tests/TestCase/Controller/MailControllerTest.php index 1d6241a7cf..f2e101b1f5 100644 --- a/plugins/bc-mail/tests/TestCase/Controller/MailControllerTest.php +++ b/plugins/bc-mail/tests/TestCase/Controller/MailControllerTest.php @@ -19,7 +19,9 @@ use BaserCore\Utility\BcContainerTrait; use BcMail\Test\Factory\MailContentFactory; use BcMail\Test\Factory\MailFieldsFactory; +use BcMail\View\Helper\MailformHelper; use Cake\TestSuite\IntegrationTestTrait; +use Cake\View\View; use CakephpFixtureFactories\Scenario\ScenarioAwareTrait; class MailControllerTest extends BcTestCase @@ -188,7 +190,14 @@ public function test_back() */ public function testCaptcha() { - $this->markTestIncomplete('このテストは、まだ実装されていません。'); + $this->loadFixtureScenario(InitAppScenario::class); + ContentFactory::make(['id' => 1, 'plugin' => 'BcMail', 'type' => 'MailContent', 'entity_id' => 1, 'url' => '/contact/', 'site_id' => 1, 'lft' => 1, 'rght' => 2])->persist(); + MailContentFactory::make(['id' => 1, 'form_template' => 'default', 'mail_template' => 'mail_default'])->persist(); + + //正常テスト + ob_start(); + $this->get('/contact/captcha/38763366'); + $this->assertNotNull(ob_get_clean()); } /**