public function testListsNested() { $array = CategoryNested::listsNested('name', 'id'); $this->assertEquals([1 => 'Category Orange', 2 => ' Autumn Leaves', 3 => ' September', 4 => ' October', 5 => ' November', 6 => ' Summer Breeze', 7 => 'Category Green', 8 => ' Winter Snow', 9 => ' Spring Trees'], $array); $array = CategoryNested::listsNested('name', 'id', '--'); $this->assertEquals([1 => 'Category Orange', 2 => '--Autumn Leaves', 3 => '----September', 4 => '----October', 5 => '----November', 6 => '--Summer Breeze', 7 => 'Category Green', 8 => '--Winter Snow', 9 => '--Spring Trees'], $array); $array = CategoryNested::listsNested('description', 'name', '**'); $this->assertEquals(['Category Orange' => 'A root level test category', 'Autumn Leaves' => '**Disccusion about the season of falling leaves.', 'September' => '****The start of the fall season.', 'October' => '****The middle of the fall season.', 'November' => '****The end of the fall season.', 'Summer Breeze' => '**Disccusion about the wind at the ocean.', 'Category Green' => 'A root level test category', 'Winter Snow' => '**Disccusion about the frosty snow flakes.', 'Spring Trees' => '**Disccusion about the blooming gardens.'], $array); }
/** * @expectedException \Exception * @expectedExceptionMessage Column mismatch in listsNested method */ public function testListsNestedUnknownColumn() { CategoryNested::listsNested('custom_name', 'id'); }