fix empty array bug
This commit is contained in:
parent
a5d2a62745
commit
d8b6c0f859
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,3 +5,5 @@
|
|||||||
.settings/
|
.settings/
|
||||||
coverage/
|
coverage/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
@ -430,6 +430,7 @@ class ComicPressStoryline {
|
|||||||
$children = array($parent);
|
$children = array($parent);
|
||||||
do {
|
do {
|
||||||
$found_children = false;
|
$found_children = false;
|
||||||
|
if (is_array($this->_structure)) {
|
||||||
foreach ($this->_structure as $category_id => $info) {
|
foreach ($this->_structure as $category_id => $info) {
|
||||||
if (!in_array($category_id, $children)) {
|
if (!in_array($category_id, $children)) {
|
||||||
if (isset($info['parent'])) {
|
if (isset($info['parent'])) {
|
||||||
@ -440,6 +441,7 @@ class ComicPressStoryline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
} while ($found_children);
|
} while ($found_children);
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
@ -384,6 +384,11 @@ class ComicPressStorylineTest extends PHPUnit_Framework_TestCase {
|
|||||||
$this->assertEquals(array(2,3,4), $this->css->_find_children($search));
|
$this->assertEquals(array(2,3,4), $this->css->_find_children($search));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testFindChildrenEmptyStructure() {
|
||||||
|
$this->css->_structure = false;
|
||||||
|
$this->assertEquals(array(2), $this->css->_find_children(2));
|
||||||
|
}
|
||||||
|
|
||||||
function testFindLevelOrAbove() {
|
function testFindLevelOrAbove() {
|
||||||
$this->css->_structure = array(
|
$this->css->_structure = array(
|
||||||
'1' => array('next' => 2, 'level' => 1),
|
'1' => array('next' => 2, 'level' => 1),
|
||||||
|
Loading…
Reference in New Issue
Block a user