Skip to content

Commit

Permalink
Merge pull request #4063 from HungDV2022/unittest_MailHelper_getPubli…
Browse files Browse the repository at this point in the history
…shedMailContents

MailHelper::getPublishedMailContents() ユニットテスト
  • Loading branch information
HungDV2022 authored Dec 5, 2024
2 parents 5d4c410 + 91273bc commit ae024de
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 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 @@ -340,6 +340,7 @@ public function isMail(): bool
* @return mixed
* @checked
* @noTodo
* @unitTest
*/
public function getPublishedMailContents(int $siteId)
{
Expand Down
20 changes: 18 additions & 2 deletions plugins/bc-mail/tests/TestCase/View/Helper/MailHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
use BaserCore\TestSuite\BcTestCase;
use BaserCore\View\BcFrontAppView;
use BcMail\Model\Entity\MailContent;
use BcMail\Test\Scenario\MailContentsScenario;
use BcMail\View\Helper\MailHelper;
use Cake\ORM\Entity;
use Cake\View\View;
use CakephpFixtureFactories\Scenario\ScenarioAwareTrait;

/**
* Class MailHelperTest
Expand All @@ -25,6 +26,11 @@
*/
class MailHelperTest extends BcTestCase
{
/**
* ScenarioAwareTrait
*/
use ScenarioAwareTrait;

/**
* set up
*/
Expand All @@ -41,7 +47,7 @@ public function setUp(): void
*/
public function tearDown(): void
{
// unset($this->Mail);
unset($this->MailHelper);
parent::tearDown();
}

Expand Down Expand Up @@ -250,4 +256,14 @@ public function test_isMail()
$result = $this->MailHelper->isMail();
$this->assertTrue($result);
}

/**
* test getPublishedMailContents
*/
public function testGetPublishedMailContents()
{
$this->loadFixtureScenario(MailContentsScenario::class);
$rs = $this->MailHelper->getPublishedMailContents(1);
$this->assertEquals(1, $rs->count());
}
}

0 comments on commit ae024de

Please sign in to comment.