Skip to content

Commit

Permalink
Merge pull request #4058 from HungDV2022/unittest_MailHelper_getMailT…
Browse files Browse the repository at this point in the history
…emplates

MailHelper::getMailTemplatesユニットテスト
  • Loading branch information
HungDV2022 authored Dec 3, 2024
2 parents 4c045aa + 782e5aa commit 0015233
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
1 change: 1 addition & 0 deletions plugins/bc-mail/src/View/Helper/MailHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public function getFormTemplates($siteId = 1)
* @todo 他のヘルパに移動する
* @checked
* @noTodo
* @unitTest
*/
public function getMailTemplates($siteId = 1)
{
Expand Down
18 changes: 5 additions & 13 deletions plugins/bc-mail/tests/TestCase/View/Helper/MailHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,11 @@ public function testGetFormTemplates()
*/
public function testGetMailTemplates()
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
$View = new View(null);
$View->set('siteConfig', Configure::read('BcSite'));
$this->Mail->BcBaser = new BcBaserHelper($View);
$result = $this->Mail->getMailTemplates();
$expected = [
'mail_default' => 'mail_default',
'default' => 'default',
'reset_password' => 'reset_password',
'send_activate_url' => 'send_activate_url',
'send_activate_urls' => 'send_activate_urls',
];
$this->assertEquals($result, $expected, 'メールテンプレートの取得結果が違います。');
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);
}

/**
Expand Down

0 comments on commit 0015233

Please sign in to comment.