cakephp/cakephp — pull request #2925 by ndm2 (2014-03-01 18:15:28+00:00)
Title: Fix verification of expected invocations

With a few exceptions outlined underneath, I've fixed everything that I found so far by searching for `new .*?Mock.*?` and `getMock\(\s*.*?,\s*array\(.*?\),\s*array\(.*?\),\s*('|").+?('|")` (this should find all usages of `getMock` where a classname is passed), I then made my way through the affected test files to see if there's anything that the search didn't revealed, however I'm not 100% sure if I catched everything.

Additionally to fixing the tests that failed after switching to non-manual instantiated mocks, I've also changed some of the `expects` defintions, mostly occourences of `any` where I could tell that testing for `once` or similar should be fine. Also I've removed the classname parameter from some of the `getMock()` calls in case the classnames weren't used anywhere.

Some usages of implicitly instantiated mock objects have been left unchanged because it seems to be working fine, mostly since the tests do not rely on the "after test validation", but for example on the mocked method result values or similar, see for example `AclComponentTest::setUp()`, `AuthComponentTest::testLogin()` or `RouterTest::testUsingCustomRouteClass()`. I'm unsure whether they should be changed too.

Last but not least I'm a little unsure about the fix for `HttpSocketTest::testRequest2()`. The problem is the mocked `connect` method never being invoked [as mentioned](https://github.com/cakephp/cakephp/issues/2919#issuecomment-36413279) in #2919, I've changed it from `once` to `any` for now, but that's not optimal.