From fc91d28f516a1e8a6d5697746c20c03cbf7fbccb Mon Sep 17 00:00:00 2001 From: TPGF00003 Date: Fri, 8 Nov 2024 10:14:39 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=A6=E3=83=8B=E3=83=83=E3=83=88=E3=83=86?= =?UTF-8?q?=E3=82=B9=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/MailControllerTest.php | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/plugins/bc-mail/tests/TestCase/Controller/MailControllerTest.php b/plugins/bc-mail/tests/TestCase/Controller/MailControllerTest.php index 88a552da50..e4a8eb00c9 100644 --- a/plugins/bc-mail/tests/TestCase/Controller/MailControllerTest.php +++ b/plugins/bc-mail/tests/TestCase/Controller/MailControllerTest.php @@ -13,6 +13,7 @@ use BaserCore\Test\Factory\ContentFactory; use BaserCore\Test\Factory\SiteFactory; +use BaserCore\Test\Scenario\InitAppScenario; use BaserCore\TestSuite\BcTestCase; use BaserCore\Utility\BcContainerTrait; use BcMail\Test\Factory\MailContentFactory; @@ -116,11 +117,21 @@ public function testSubmit() } /** - * [private] 確認画面から戻る + * [PUBIC] メール送信完了 */ - public function test_back() + public function test_thanks() { - $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(); + + $this->session(['BcMail.MailContent' => MailContentFactory::get(1)]); + //正常テスト + $this->get('/contact/thanks'); + + $this->assertResponseOk(); + $vars = $this->_controller->viewBuilder()->getVars(); + $this->assertNotNull($vars['mailContent']); } /** @@ -128,6 +139,12 @@ 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(); + + //正常テスト + $this->get('/contact/captcha/abc'); + $this->assertResponseOk(); } }