Skip to content

Commit fc47234

Browse files
author
Denis Ristic
committed
FIXED integration test
ADDED $recursive and $isActive, flags to getChildren()
1 parent f77dadb commit fc47234

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/code/Magento/Catalog/Model/Category.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,12 +780,14 @@ public function getAllChildren($asArray = false)
780780
/**
781781
* Retrieve children ids comma separated
782782
*
783+
* @param boolean $recursive
784+
* @param boolean $isActive
783785
* @param boolean $sortByPosition
784786
* @return string
785787
*/
786-
public function getChildren($sortByPosition = false)
788+
public function getChildren($recursive = true, $isActive = true, $sortByPosition = false)
787789
{
788-
return implode(',', $this->getResource()->getChildren($this, false, true, $sortByPosition));
790+
return implode(',', $this->getResource()->getChildren($this, $recursive, $isActive, $sortByPosition));
789791
}
790792

791793
/**

dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTreeTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ public function testGetChildren()
131131
public function testGetChildrenSorted()
132132
{
133133
$this->_model->load(2);
134-
$this->assertEquals(array_diff([3, 4, 5], explode(',', $this->_model->getChildren(true))), []);
134+
$unsorted = explode(',', $this->_model->getChildren());
135+
usort($unsorted);
136+
$this->assertEquals(array_diff($unsorted, explode(',', $this->_model->getChildren(true, true, true))), []);
135137
}
136138

137139
public function testGetPathInStore()

0 commit comments

Comments
 (0)