From 91273bc0eced4d8c0f7c26991510a0eaf513e9a2 Mon Sep 17 00:00:00 2001 From: HungDV2022 Date: Wed, 4 Dec 2024 09:19:55 +0900 Subject: [PATCH] =?UTF-8?q?MailHelper::getPublishedMailContents()=20?= =?UTF-8?q?=E3=83=A6=E3=83=8B=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 --- .../bc-mail/src/View/Helper/MailHelper.php | 1 + .../TestCase/View/Helper/MailHelperTest.php | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/plugins/bc-mail/src/View/Helper/MailHelper.php b/plugins/bc-mail/src/View/Helper/MailHelper.php index 7063c5468d..1eaa131889 100755 --- a/plugins/bc-mail/src/View/Helper/MailHelper.php +++ b/plugins/bc-mail/src/View/Helper/MailHelper.php @@ -340,6 +340,7 @@ public function isMail(): bool * @return mixed * @checked * @noTodo + * @unitTest */ public function getPublishedMailContents(int $siteId) { diff --git a/plugins/bc-mail/tests/TestCase/View/Helper/MailHelperTest.php b/plugins/bc-mail/tests/TestCase/View/Helper/MailHelperTest.php index e803823d12..6815294849 100644 --- a/plugins/bc-mail/tests/TestCase/View/Helper/MailHelperTest.php +++ b/plugins/bc-mail/tests/TestCase/View/Helper/MailHelperTest.php @@ -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 @@ -25,6 +26,11 @@ */ class MailHelperTest extends BcTestCase { + /** + * ScenarioAwareTrait + */ + use ScenarioAwareTrait; + /** * set up */ @@ -41,7 +47,7 @@ public function setUp(): void */ public function tearDown(): void { -// unset($this->Mail); + unset($this->MailHelper); parent::tearDown(); } @@ -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()); + } }