コード例 #1
0
 public function test_can_authorize()
 {
     $this->routeable->authorize(true);
     $this->assertTrue($this->routeable->isAuthorized());
     $this->routeable->authorize(false);
     $this->assertFalse($this->routeable->isAuthorized());
 }
コード例 #2
0
 public function test_can_set_route()
 {
     $urlMock = m::mock('Illuminate\\Contracts\\Routing\\UrlGenerator');
     $urlMock->shouldReceive('route')->andReturn('url');
     $this->container->shouldReceive('make')->andReturn($urlMock);
     $this->routeable->route('route');
     $this->assertEquals('url', $this->routeable->getUrl());
 }
コード例 #3
0
 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());
 }