public function testParseDataIncludesChild() { $item = new MenuItem(); $child = new MenuItem(); $child2 = new MenuItem(); // $child->name = 'test'; $child2->name = 'test2'; // $item->getChildren()->add($child); $item->getChildren()->add($child2); // $parseData = $item->getParseData(); $this->assertArrayHasKey('children', $parseData); $this->assertTrue(sizeof($parseData['children']) == 2); }
public function testGroupAddSupportChildren() { $correctFixture = array(array('name' => 'Link 1', 'children' => array(array('name' => 'Link 1.1'), array('name' => 'Link 1.2'), array('name' => 'Link 1.3', 'children' => array(array('name' => 'Link 1.3.1'))))), array('name' => 'Link 2')); $item = new MenuItem(); $item->getChildren()->add($correctFixture); $titleFixture = $correctFixture[0]['children'][2]['children'][0]['name']; $testValue = $item->getChildren()->get(0)->getChildren()->get(2)->getChildren()->get(0)->name; $this->assertEquals($titleFixture, $testValue); }