-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4020 from thangnnmd/unitTest_BlogCommentMailer_se…
…ndCommentToAdmin BlogCommentMailer::sendCommentToAdmin
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
plugins/bc-blog/tests/TestCase/Mailer/BlogCommentMailerTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace BcBlog\Test\TestCase\Mailer; | ||
|
||
use BaserCore\Test\Factory\SiteConfigFactory; | ||
use BaserCore\TestSuite\BcTestCase; | ||
use BcBlog\Mailer\BlogCommentMailer; | ||
|
||
class BlogCommentMailerTest extends BcTestCase | ||
{ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
SiteConfigFactory::make(['name' => 'email', 'value' => '[email protected]'])->persist(); | ||
$this->BlogCommentMailer = new BlogCommentMailer(); | ||
} | ||
|
||
public function tearDown(): void | ||
{ | ||
parent::tearDown(); | ||
} | ||
|
||
/** | ||
* test sendCommentToAdmin | ||
*/ | ||
public function testSendCommentToAdmin() | ||
{ | ||
$this->BlogCommentMailer->sendCommentToAdmin('test', ['test' => 'test']); | ||
$this->assertEquals('BcBlog.blog_comment_admin', $this->BlogCommentMailer->viewBuilder()->getTemplate()); | ||
$this->assertEquals(['test' => 'test'], $this->BlogCommentMailer->viewBuilder()->getVars()); | ||
} | ||
} |