Skip to content

Commit

Permalink
Merge pull request #4020 from thangnnmd/unitTest_BlogCommentMailer_se…
Browse files Browse the repository at this point in the history
…ndCommentToAdmin

BlogCommentMailer::sendCommentToAdmin
  • Loading branch information
HungDV2022 authored Nov 15, 2024
2 parents 56f0eba + 912a39d commit 990a3d5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/bc-blog/src/Mailer/BlogCommentMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class BlogCommentMailer extends BcMailer
* @param array $data
* @checked
* @noTodo
* @UnitTest
*/
public function sendCommentToAdmin(string $senderName, array $data)
{
Expand Down
32 changes: 32 additions & 0 deletions plugins/bc-blog/tests/TestCase/Mailer/BlogCommentMailerTest.php
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());
}
}

0 comments on commit 990a3d5

Please sign in to comment.