/** * @return array */ public function toArray() { if ($this->isActive() and !$this->hasClassProperty(['active', 'open'])) { $this->setHtmlAttribute('class', 'active open'); } if ($this->hasChild() and !$this->hasClassProperty('mm-dropdown')) { $this->setHtmlAttribute('class', 'mm-dropdown'); } return parent::toArray(); }
/** * @covers Page::toArray */ public function testToArray() { $page = new Page('Title', 'http://site.com', 'pageId', 550, 'fa fa-user'); $this->assertEquals(['child' => [], 'hasChild' => false, 'id' => 'pageId', 'title' => 'Title', 'icon' => '<i class="fa fa-user"></i>', 'priority' => 550, 'url' => 'http://site.com', 'path' => ['Title'], 'isActive' => false, 'attributes' => '', 'badge' => null], $page->toArray()); }