Skip to content

Commit

Permalink
add comment and add unitTest_BlogCategoriesTable_getByName
Browse files Browse the repository at this point in the history
  • Loading branch information
thangnn committed Feb 28, 2024
1 parent 078fbda commit 3d3beae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions plugins/bc-blog/src/Model/Table/BlogCategoriesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ public function hasChild($id)
* @param int $blogContentId
* @param string $name
* @param array $options
* @notodo
* @checked
* @unitTest
* @return EntityInterface
*/
public function getByName($blogContentId, $name, $options = [])
Expand Down
2 changes: 2 additions & 0 deletions plugins/bc-blog/src/View/Helper/BlogHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2023,6 +2023,8 @@ public function isSameSiteBlogContent($blogContentId)
* @param string $categoryName
* @param array $options
* @return EntityInterface
* @notodo
* @checked
* @unitTest
*/
public function getCategoryByName($blogContentId, $categoryName = '', $options = [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,19 @@ public function testHasChild()

/**
* カテゴリ名よりカテゴリを取得する
* getByName
* @dataProvider getByNameDataProvider
* @param int $blogCategoryId
* @param string $name
* @param bool $expects
*/
public function testGetByName($blogCategoryId, $name, $expects)
{
$this->markTestIncomplete('こちらのテストはまだ未確認です');
$result = $this->BlogCategory->getByName($blogCategoryId, $name);
//データ生成
BlogCategoryFactory::make(['name' => 'child', 'blog_content_id' => 1])->persist();
BlogCategoryFactory::make(['name' => 'name', 'blog_content_id' => 2])->persist();
$result = $this->BlogCategoriesTable->getByName($blogCategoryId, $name);
//戻り値を確認
$this->assertEquals($expects, (bool)$result);
}

Expand Down

0 comments on commit 3d3beae

Please sign in to comment.