Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BcContentsHelper::isParentId のユニットテスト #3869

Open
wants to merge 2 commits into
base: 5.1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugins/baser-core/src/View/Helper/BcContentsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,10 +553,11 @@ private function _getContent($conditions, $field = null)
* @return bool
* @checked
* @noTodo
* @unitTest
*/
public function isParentId($id, $parentId)
{
$parentIds = $this->_Contents->find('treeList', valuePath: 'id')->where(['id' => $id])->all()->toArray();
$parentIds = $this->_Contents->find('treeList', valuePath: 'parent_id')->where(['id' => $id])->all()->toArray();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryuring こちらの仕様はよくわからないのですが、valuePathはparent_idの方が正しいだと思います。間違ったら仕様を詳しく教えていただけませんか。

if (!$parentIds) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,17 +525,16 @@ public function testGetContentByUrl()
*/
public function testIsParentId($id, $parentId, $expects)
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
$this->assertEquals($expects, $this->BcContents->isParentId($id, $parentId));
}

public static function isParentIdDataProvider()
{
return [
[2, 1, true],
[2, 1, false],
[5, 1, true],
[5, 2, false],
[6, 21, true]
[26, 24, true]
];
}

Expand Down
Loading