Exemplo n.º 1
0
 public function __construct(array $properties)
 {
     parent::__construct($properties);
     $this->child = [];
 }
Exemplo n.º 2
0
 public function testToArray_withInactive_shouldReturnExpectedArray()
 {
     //
     // @expected
     //
     $expected = ['name' => 'home', 'label' => 'Home', 'link' => '/home', 'active' => false];
     //
     // @conditions
     //
     $currentUri = 'http://localhost/another';
     $menu = new MenuItem(['name' => 'home', 'label' => 'Home', 'link' => '/home', 'rule' => function (MenuItemContract $item) {
         return (bool) preg_match('#home$#', $item->getUri());
     }]);
     $menu->setUri($currentUri);
     $result = $menu->toArray();
     //
     // @asserts
     //
     $this->assertEquals($expected, $result);
 }