Handling Laravel HttpException in Unit Testing
问题 One of my test functions for unit testing in Laravel keeps erroring out. I'm trying to assert that requesting a specific page without certain conditions being met triggers a 403 FORBIDDEN error. My test case function is this: public function testNoAjaxCall() { $this->call('POST', 'xyz', array()); $this->assertResponseStatus(403); } In the controller action this is routed to, I have this: if(!Input::has('ajax') || Input::get('ajax') != 1) { // Drop all 'non-ajax' requests. App::abort(403,