Example #1
0
 public function testInList()
 {
     $this->request->shouldReceive('getClientIp')->once()->andReturn('127.0.0.1');
     $list = Mockery::mock('Algorit\\Router\\Contracts\\ListInterface');
     $list->shouldReceive('get')->with('whitelist')->once()->andReturn(array('127.0.0.1'));
     $list->shouldReceive('get')->with('blacklist')->once()->andReturn(array('127.0.0.1'));
     $router = new Router($this->request, $list);
     $whitelist = $router->whitelist(function () {
         return 'this will be returned';
     });
     $this->assertEquals('this will be returned', $whitelist);
     $blacklist = $router->blacklist(function () {
         return 'this will be returned';
     });
     $this->assertEquals('this will be returned', $blacklist);
 }