From d90f2ea20a3fd944f9a22efebb38186b2970f737 Mon Sep 17 00:00:00 2001 From: HungDV2022 Date: Wed, 4 Dec 2024 09:12:42 +0900 Subject: [PATCH] =?UTF-8?q?MailHelper::getToken()=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/View/Helper/MailHelper.php | 1 + .../TestCase/View/Helper/MailHelperTest.php | 17 ++++++----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/plugins/bc-mail/src/View/Helper/MailHelper.php b/plugins/bc-mail/src/View/Helper/MailHelper.php index ddab526f16..d0e86a05dd 100755 --- a/plugins/bc-mail/src/View/Helper/MailHelper.php +++ b/plugins/bc-mail/src/View/Helper/MailHelper.php @@ -244,6 +244,7 @@ public function link($title, $contentsName, $datas = [], $options = []) * @return string * @checked * @noTodo + * @unitTest */ public function getToken() { diff --git a/plugins/bc-mail/tests/TestCase/View/Helper/MailHelperTest.php b/plugins/bc-mail/tests/TestCase/View/Helper/MailHelperTest.php index fb144e7c27..e803823d12 100644 --- a/plugins/bc-mail/tests/TestCase/View/Helper/MailHelperTest.php +++ b/plugins/bc-mail/tests/TestCase/View/Helper/MailHelperTest.php @@ -21,7 +21,7 @@ /** * Class MailHelperTest * - * @property MailHelper $Mail + * @property MailHelper $MailHelper */ class MailHelperTest extends BcTestCase { @@ -31,7 +31,9 @@ class MailHelperTest extends BcTestCase public function setUp(): void { parent::setUp(); - $this->MailHelper = new MailHelper(new View()); + SiteFactory::make(['id' => '1'])->persist(); + $view = new BcFrontAppView($this->getRequest('/')); + $this->MailHelper = new MailHelper($view); } /** @@ -114,9 +116,6 @@ public function testGetForm() */ public function testGetFormTemplates() { - SiteFactory::make(['id' => '1'])->persist(); - $view = new BcFrontAppView($this->getRequest('/')); - $this->MailHelper = new MailHelper($view); $result = $this->MailHelper->getFormTemplates(1); $this->assertEquals(['default' => 'default'], $result); } @@ -126,9 +125,6 @@ public function testGetFormTemplates() */ public function testGetMailTemplates() { - SiteFactory::make(['id' => '1'])->persist(); - $view = new BcFrontAppView($this->getRequest('/')); - $this->MailHelper = new MailHelper($view); $result = $this->MailHelper->getMailTemplates(1); $this->assertEquals(['mail_default' => 'mail_default'], $result); } @@ -138,10 +134,9 @@ public function testGetMailTemplates() */ public function testGetToken() { - $this->markTestIncomplete('このテストは、まだ実装されていません。'); - $result = $this->Mail->getToken(); + $result = $this->MailHelper->getToken(); $expected = '/.*/s'; - $this->assertMatchesRegularExpression($expected, $result, 'スクリプトが取得できません。'); + $this->assertMatchesRegularExpression($expected, $result); } /**