Skip to content

Commit

Permalink
Add unitTest_MailHelper_descriptionExists (#3809)
Browse files Browse the repository at this point in the history
Co-authored-by: thangnn <[email protected]>
  • Loading branch information
thangnnmd and thangnn committed Sep 17, 2024
1 parent 3a44ac7 commit 324cd83
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions plugins/bc-mail/tests/TestCase/View/Helper/MailHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use BaserCore\TestSuite\BcTestCase;
use BcMail\Model\Entity\MailContent;
use BcMail\View\Helper\MailHelper;
use Cake\ORM\Entity;
use Cake\View\View;

/**
Expand Down Expand Up @@ -63,13 +64,33 @@ public function testGetDescription()

/**
* 説明文の存在確認
* @param $description
* @param $expected
* @dataProvider descriptionExistsProvider
*/
public function testDescriptionExists()
public function testDescriptionExists($description, $expected)
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
$this->Mail->setMailContent(1);
$result = $this->Mail->descriptionExists();
$this->assertTrue($result, "メールの説明文が指定されていません。");
//setUp
$mailContent = new Entity([
'description' => $description
]);
$this->MailHelper->currentMailContent = $mailContent;

$result = $this->MailHelper->descriptionExists();

$this->assertEquals($expected, $result);
}

public static function descriptionExistsProvider()
{
return [
['This is a test description', true],
['', false],
[null, false],
['0', false],
[' ', true],
['<p>This is a <strong>HTML</strong> description</p>', true],
];
}

/**
Expand Down

0 comments on commit 324cd83

Please sign in to comment.