public function test_get_items_sorts_items_by_weight() { $item = new DefaultItem($this->container); $item->name('second item'); $item->weight(2); $this->itemable->addItem($item); $item = new DefaultItem($this->container); $this->itemable->addItem($item); $item->name('first item'); $item->weight(1); $this->assertCount(2, $this->itemable->getItems()); $this->assertEquals('first item', $this->itemable->getItems()->first()->getName()); }
public function test_can_add_a_append() { $mock = $this->mockContainerMakeForAppend(); $mock->shouldReceive('route'); $mock->shouldReceive('icon'); $mock->shouldReceive('name'); $mock->shouldReceive('getUrl')->andReturn('url'); $mock->shouldReceive('getIcon')->andReturn('icon'); $mock->shouldReceive('getName')->andReturn('name'); $this->item->append('route', 'icon', 'name'); $this->assertInstanceOf('Illuminate\\Support\\Collection', $this->item->getAppends()); $this->assertCount(1, $this->item->getAppends()); $this->assertEquals('url', $this->item->getAppends()->first()->getUrl()); $this->assertEquals('icon', $this->item->getAppends()->first()->getIcon()); $this->assertEquals('name', $this->item->getAppends()->first()->getName()); }