Skip to content

Commit

Permalink
[basercms] unitTest_BlogCommentsService_getBlogContent
Browse files Browse the repository at this point in the history
  • Loading branch information
thangnn committed Feb 5, 2024
1 parent 55e36ea commit efc1525
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/bc-blog/src/Service/BlogCommentsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ public function add(int $blogContentId, int $blogPostId, array $postData)
* @return EntityInterface
* @checked
* @noTodo
* @unitTest
*/
public function getBlogContent($blogContentId)
{
Expand Down
21 changes: 21 additions & 0 deletions plugins/bc-blog/tests/TestCase/Service/BlogCommentsServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,25 @@ public function testBatch()
$this->assertEquals($count - 3, $this->BlogCommentsService->getIndex(['blog_post_id' => 1])->count());
}

/**
* getBlogContent
* @return void
*/
public function testGetBlogContent(){
$this->loadFixtureScenario(
BlogContentScenario::class,
1, // id
1, // siteId
null, // parentId
'news1', // name
'/news/' // url
);
BlogPostFactory::make(['id' => 1, 'blog_content_id' => 1])->persist();
$blogContent = $this->BlogCommentsService->getBlogContent(1);
$this->assertEquals('ディスクリプション', $blogContent['description']);
$this->assertEquals('homePage', $blogContent['template']);
}



}

0 comments on commit efc1525

Please sign in to comment.