{"action":"closed","issue":{"url":"https://api.github.com/repos/dingo/api/issues/561","labels_url":"https://api.github.com/repos/dingo/api/issues/561/labels{/name}","comments_url":"https://api.github.com/repos/dingo/api/issues/561/comments","events_url":"https://api.github.com/repos/dingo/api/issues/561/events","html_url":"https://github.com/dingo/api/issues/561","id":99203878,"number":561,"title":"Mock app('api.router') as InternalRequest","user":{"login":"lightvision","id":403264,"avatar_url":"https://avatars.githubusercontent.com/u/403264?v=3","gravatar_id":"","url":"https://api.github.com/users/lightvision","html_url":"https://github.com/lightvision","followers_url":"https://api.github.com/users/lightvision/followers","following_url":"https://api.github.com/users/lightvision/following{/other_user}","gists_url":"https://api.github.com/users/lightvision/gists{/gist_id}","starred_url":"https://api.github.com/users/lightvision/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lightvision/subscriptions","organizations_url":"https://api.github.com/users/lightvision/orgs","repos_url":"https://api.github.com/users/lightvision/repos","events_url":"https://api.github.com/users/lightvision/events{/privacy}","received_events_url":"https://api.github.com/users/lightvision/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-05T13:23:38Z","updated_at":"2015-08-10T10:30:12Z","closed_at":"2015-08-10T10:30:12Z","body":"@jasonlewis I know that this is a stupid question and this is not dingo/api fault, but how can I mock app('api.router')->app('api.router')->getCurrentRequest() to pass as InternalRequest.\r\n\r\nI have the following code:\r\n```\r\nprivate function overridePaginatorDefaultVariablesBasedOnRequestType(Collection $collection) {\r\n        \r\n        # we must allow some defaults overridings if this is an internal request\r\n        if (app('api.router')->getCurrentRequest() instanceof InternalRequest) {\r\n\r\n            # disable the number of items to be displayed / page\r\n            if ($this->request->get('limit') == 0) {\r\n                $this->request->merge(['limit' => $collection->count()]);\r\n\r\n                # since we display all items we'll set the page to 1\r\n                $this->request->merge(['page' => 1]);\r\n            }\r\n        }\r\n    }\r\n```\r\n\r\nand in the test:\r\n```\r\n        $this->app['request']->merge(['limit'=>0]);\r\n        $this->app['request']->merge(['page'=>100]);\r\n        \r\n        \r\n        $apiRouterMocked=  $this->getMock(\\Dingo\\Api\\Http\\InternalRequest::class, ['getCurrentRequest']);\r\n        \r\n        $apiRouterMocked->expects($this->any())\r\n                ->method('getCurrentRequest')\r\n                ->willReturn(TRUE);\r\n        \r\n        $this->app->instance('Dingo\\Api\\Routing\\Router', $apiRouterMocked);\r\n        \r\n        $overidePaginatorDefaultVariables=  $this->getHiddenMethod($this->apiBaseController, 'overridePaginatorDefaultVariablesBasedOnRequestType');\r\n        \r\n        $result=$overidePaginatorDefaultVariables->invoke($this->apiBaseController, new \\Illuminate\\Support\\Collection());\r\n\r\n        $this->assertEquals($this->app['request']->get('limit'), 0);\r\n        $this->assertEquals($this->app['request']->get('page'), 1);\r\n```\r\n\r\nThe test is failing because never pass the ``` if (app('api.router')->getCurrentRequest() instanceof InternalRequest) {} ```"}}