diff --git a/plugins/bc-mail/src/View/Helper/MailHelper.php b/plugins/bc-mail/src/View/Helper/MailHelper.php index ddab526f16..7063c5468d 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() { @@ -256,6 +257,7 @@ public function getToken() * @return void * @checked * @noTodo + * @unitTest */ public function token() { 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); } /**