Skip to content

Commit

Permalink
Merge pull request #4057 from thangnnmd/unitTest_MailHelper_getFormTe…
Browse files Browse the repository at this point in the history
…mplates

MailHelper::getFormTemplates
  • Loading branch information
HungDV2022 authored Dec 3, 2024
2 parents 7bc51a0 + 959f421 commit 7a938a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 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 @@ -96,6 +96,7 @@ public function setMailContent($mailContentId = null)
* @todo 他のヘルパーに移動する
* @checked
* @noTodo
* @unitTest
*/
public function getFormTemplates($siteId = 1)
{
Expand Down
17 changes: 7 additions & 10 deletions plugins/bc-mail/tests/TestCase/View/Helper/MailHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
*/
namespace BcMail\Test\TestCase\View\Helper;
use BaserCore\Test\Factory\ContentFactory;
use BaserCore\Test\Factory\SiteFactory;
use BaserCore\TestSuite\BcTestCase;
use BaserCore\View\BcFrontAppView;
use BcMail\Model\Entity\MailContent;
use BcMail\View\Helper\MailHelper;
use Cake\ORM\Entity;
Expand Down Expand Up @@ -112,16 +114,11 @@ public function testGetForm()
*/
public function testGetFormTemplates()
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
$View = new View(null);
$View->set('siteConfig', Configure::read('BcSite'));
$this->Mail->BcBaser = new BcBaserHelper($View);
$result = $this->Mail->getFormTemplates();
$expected = [
'default' => 'default',
'smartphone' => 'smartphone'
];
$this->assertEquals($result, $expected, 'フォームテンプレートの取得結果が違います。');
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);
}

/**
Expand Down

0 comments on commit 7a938a4

Please sign in to comment.