diff --git a/plugins/bc-blog/src/Service/BlogCommentsService.php b/plugins/bc-blog/src/Service/BlogCommentsService.php index 26ed5e6907..20869588be 100755 --- a/plugins/bc-blog/src/Service/BlogCommentsService.php +++ b/plugins/bc-blog/src/Service/BlogCommentsService.php @@ -187,6 +187,7 @@ public function add(int $blogContentId, int $blogPostId, array $postData) * @return EntityInterface * @checked * @noTodo + * @unitTest */ public function getBlogContent($blogContentId) { diff --git a/plugins/bc-blog/tests/TestCase/Service/BlogCommentsServiceTest.php b/plugins/bc-blog/tests/TestCase/Service/BlogCommentsServiceTest.php index 7d27a0606d..2c1febeadb 100755 --- a/plugins/bc-blog/tests/TestCase/Service/BlogCommentsServiceTest.php +++ b/plugins/bc-blog/tests/TestCase/Service/BlogCommentsServiceTest.php @@ -217,4 +217,34 @@ public function testBatch() $this->assertEquals($count - 3, $this->BlogCommentsService->getIndex(['blog_post_id' => 1])->count()); } + /** + * getBlogContent + * @return void + */ + public function testGetBlogContent() + { + //created blogPost + $this->loadFixtureScenario( + BlogContentScenario::class, + 1, // id + 1, // siteId + null, // parentId + 'news1', // name + '/news/' // url + ); + BlogPostFactory::make(['id' => 1, 'blog_content_id' => 1])->persist(); + + //check getBlogContent + $blogContent = $this->BlogCommentsService->getBlogContent(1); + + //check description + $this->assertEquals('ディスクリプション', $blogContent['description']); + + //check template + $this->assertEquals('default', $blogContent['template']); + + //check content no exist + $blogContent = $this->BlogCommentsService->getIndex(['id' => 2])->count(); + $this->assertEquals(0, $blogContent); + } }