mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 12:48:24 +01:00
Strict fixes for e_tree_model::flattenTree()
- FIX: Null check during child recursion of e_tree_model::flattenTree() - FIX: TreeModelTest::testTreeParentsAreAssignedCorrectly() apparently never worked until now because the wrong index was used
This commit is contained in:
parent
d6eafdc3fc
commit
a1560b1989
@ -3519,7 +3519,7 @@ class e_tree_model extends e_front_model
|
||||
|
||||
foreach($tree as $item)
|
||||
{
|
||||
$children = $item['_children'];
|
||||
$children = isset($item['_children']) ? $item['_children'] : null;
|
||||
unset($item['_children']);
|
||||
$item['_depth'] = $depth;
|
||||
if($depth > 0)
|
||||
|
@ -52,11 +52,11 @@ class TreeModelTest extends \Codeception\Test\Unit
|
||||
{
|
||||
$key = $this->sample_key;
|
||||
$parent_key = $this->sample_parent_key;
|
||||
$l0_id = $this->tree[1][$key];
|
||||
$l1_id = $this->tree[1]['_children'][0][$key];
|
||||
$l1_parent = $this->tree[1]['_children'][0][$parent_key];
|
||||
$l2_id = $this->tree[1]['_children'][0]['_children'][0][$key];
|
||||
$l2_parent = $this->tree[1]['_children'][0]['_children'][0][$parent_key];
|
||||
$l0_id = $this->tree[0][$key];
|
||||
$l1_id = $this->tree[0]['_children'][0][$key];
|
||||
$l1_parent = $this->tree[0]['_children'][0][$parent_key];
|
||||
$l2_id = $this->tree[0]['_children'][0]['_children'][0][$key];
|
||||
$l2_parent = $this->tree[0]['_children'][0]['_children'][0][$parent_key];
|
||||
|
||||
$this->assertEquals($l0_id, $l1_parent);
|
||||
$this->assertEquals($l1_id, $l2_parent);
|
||||
|
Loading…
x
Reference in New Issue
Block a user