{"action":"opened","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/8480","repository_url":"https://api.github.com/repos/cakephp/cakephp","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/8480/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/8480/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/8480/events","html_url":"https://github.com/cakephp/cakephp/issues/8480","id":141363677,"number":8480,"title":"2.8  Calling testAction twice with a URL array fails","user":{"login":"ravage84","id":625761,"avatar_url":"https://avatars.githubusercontent.com/u/625761?v=3","gravatar_id":"","url":"https://api.github.com/users/ravage84","html_url":"https://github.com/ravage84","followers_url":"https://api.github.com/users/ravage84/followers","following_url":"https://api.github.com/users/ravage84/following{/other_user}","gists_url":"https://api.github.com/users/ravage84/gists{/gist_id}","starred_url":"https://api.github.com/users/ravage84/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravage84/subscriptions","organizations_url":"https://api.github.com/users/ravage84/orgs","repos_url":"https://api.github.com/users/ravage84/repos","events_url":"https://api.github.com/users/ravage84/events{/privacy}","received_events_url":"https://api.github.com/users/ravage84/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-16T18:37:00Z","updated_at":"2016-03-16T18:37:00Z","closed_at":null,"body":"CakePHP 2.8.2\r\nWindows\r\nApache2\r\n\r\nWhen calling ``testAction()`` with a URL array instead of a URL string, it fails the second time with a ``MissingControllerException Controller class C*redacted*Controller could not be found.`` error message in the web test runner or  ``MissingControllerException Controller class ConsoleController could not be found.``error message in the console (C*redacted* = the app sub directory in the web root).\r\n\r\nThe problem seems to be, that the second time in ``Router::url()``, the ``Router::_requests`` property is not null anymore but contains a mocked request, which then let's the Router return a wrong URL, which then gets used to create a controller mock.\r\n\r\nMy (simplified) test code:\r\n\r\n```` php\r\n\t\t$itemId = 3;\r\n\t\t$this->testAction(\r\n\t\t\tarray('controller' => $this->_controllerName, 'action' => 'get_physical_slots_options', $itemId),\r\n\t\t\tarray('method' => 'get')\r\n\t\t);\r\n\r\n\t\t$itemId = 8;\r\n\t\t$this->testAction(\r\n\t\t\tarray('controller' => $this->_controllerName, 'action' => 'get_physical_slots_options', $itemId),\r\n\t\t\tarray('method' => 'get')\r\n\t\t);\r\n````\r\n\r\nAutoMock is enabled and before calling the first time, there is already a manually generated mock.\r\n\r\nFirst call to testAction:\r\n\r\n![parse_route_first](https://cloud.githubusercontent.com/assets/625761/13824163/308b80de-ebad-11e5-8d53-597e62815122.png)\r\n\r\n![automock_bug_first](https://cloud.githubusercontent.com/assets/625761/13824154/2bea70d0-ebad-11e5-83d0-059c0246c5d0.png)\r\n\r\nSecond call to testAction:\r\n\r\n![parse_route_second](https://cloud.githubusercontent.com/assets/625761/13824196/466f1172-ebad-11e5-9258-53eccc0c0fa8.png)\r\n\r\n![automock_bug_second](https://cloud.githubusercontent.com/assets/625761/13824353/f115d9da-ebad-11e5-9f00-118334cee65b.png)\r\n\r\n"}}