public function testPreDispatchNonWhitelistedActionViaAjaxRequest() { $this->request->setHeader('X_REQUESTED_WITH', 'XMLHttpRequest')->setModuleName('default')->setControllerName('foo')->setActionName('home'); $this->plugin->preDispatch($this->request); $this->assertEquals(500, $this->response->getHttpResponseCode()); $this->assertEquals(json_encode(array('redirect' => '/user/login')), $this->response->getBody()); }