Exemplo n.º 1
0
 public function testActionMethod()
 {
     $router = Mockery::mock('\\Illuminate\\Routing\\Router');
     $router->shouldReceive('currentRouteAction')->times(4)->andReturn('fooController@bar');
     $active = new \HieuLe\Active\Active($router);
     $this->assertEquals('active', $active->action('fooController@bar'));
     $this->assertEquals('selected', $active->action(['barController@baz', 'fooController@bar'], 'selected'));
     $this->assertEquals('', $active->action(['barController@baz', 'fooController@baz'], 'selected'));
     $this->assertEquals('normal', $active->action(['barController@baz', 'fooController@baz'], 'selected', false, 'normal'));
     $router->shouldReceive('currentRouteAction')->times(2)->andReturn(null);
     $active = new \HieuLe\Active\Active($router);
     $this->assertEquals('', $active->action(['barController@baz', 'fooController@baz'], 'selected'));
     $this->assertEquals('normal', $active->action(['barController@baz', 'fooController@baz'], 'selected', false, 'normal'));
     $router->shouldReceive('currentRouteAction')->times(4)->andReturn('App\\Http\\Controllers\\fooController@bar');
     $active = new \HieuLe\Active\Active($router);
     $this->assertEquals('active', $active->action('fooController@bar'));
     $this->assertEquals('', $active->action('App\\Http\\Controllers\\fooController@bar'));
     $this->assertEquals('active', $active->action('App\\Http\\Controllers\\fooController@bar', 'active', true));
     $this->assertEquals('normal', $active->action('fooController@bar', 'active', true, 'normal'));
 }
Exemplo n.º 2
0
 public function testActionMethod()
 {
     $router = Mockery::mock('\\Illuminate\\Routing\\Router');
     $router->shouldReceive('currentRouteAction')->times(3)->andReturn('fooController@bar');
     $active = new \HieuLe\Active\Active($router);
     $this->assertEquals('active', $active->action('fooController@bar'));
     $this->assertEquals('selected', $active->action(array('barController@baz', 'fooController@bar'), 'selected'));
     $this->assertEquals('', $active->action(array('barController@baz', 'fooController@baz'), 'selected'));
     $router->shouldReceive('currentRouteAction')->once()->andReturn(null);
     $active = new \HieuLe\Active\Active($router);
     $this->assertEquals('', $active->action(array('barController@baz', 'fooController@baz'), 'selected'));
 }