Skip to content
Permalink
Browse files

Replace all instances of getMock() with single argument.

  • Loading branch information...
ADmad committed Jun 4, 2016
1 parent 3eb93d3 commit 3cc1f9abea456ca926841c88f912d52c85ca6222
Showing with 217 additions and 217 deletions.
  1. +6 −6 tests/TestCase/Console/ShellDispatcherTest.php
  2. +8 −8 tests/TestCase/Console/ShellTest.php
  3. +10 −10 tests/TestCase/Controller/Component/PaginatorComponentTest.php
  4. +1 −1 tests/TestCase/Controller/Component/RequestHandlerComponentTest.php
  5. +1 −1 tests/TestCase/Controller/ComponentRegistryTest.php
  6. +1 −1 tests/TestCase/Controller/ComponentTest.php
  7. +16 −16 tests/TestCase/Controller/ControllerTest.php
  8. +4 −4 tests/TestCase/Database/ConnectionTest.php
  9. +9 −9 tests/TestCase/Database/Log/LoggingStatementTest.php
  10. +2 −2 tests/TestCase/Database/Schema/MysqlSchemaTest.php
  11. +1 −1 tests/TestCase/Database/Schema/PostgresSchemaTest.php
  12. +2 −2 tests/TestCase/Database/Schema/SqliteSchemaTest.php
  13. +1 −1 tests/TestCase/Database/Schema/SqlserverSchemaTest.php
  14. +6 −6 tests/TestCase/Database/Statement/StatementDecoratorTest.php
  15. +1 −1 tests/TestCase/Database/Type/BinaryTypeTest.php
  16. +1 −1 tests/TestCase/Database/Type/BoolTypeTest.php
  17. +1 −1 tests/TestCase/Database/Type/DateTimeTypeTest.php
  18. +1 −1 tests/TestCase/Database/Type/DateTypeTest.php
  19. +1 −1 tests/TestCase/Database/Type/FloatTypeTest.php
  20. +1 −1 tests/TestCase/Database/Type/IntegerTypeTest.php
  21. +1 −1 tests/TestCase/Database/Type/StringTypeTest.php
  22. +1 −1 tests/TestCase/Database/Type/TimeTypeTest.php
  23. +1 −1 tests/TestCase/Database/Type/UuidTypeTest.php
  24. +5 −5 tests/TestCase/Database/TypeTest.php
  25. +6 −6 tests/TestCase/Datasource/QueryCacherTest.php
  26. +1 −1 tests/TestCase/Error/ErrorHandlerTest.php
  27. +7 −7 tests/TestCase/Error/ExceptionRendererTest.php
  28. +3 −3 tests/TestCase/Event/EventManagerTest.php
  29. +2 −2 tests/TestCase/Form/FormTest.php
  30. +2 −2 tests/TestCase/Log/Engine/ConsoleLogTest.php
  31. +1 −1 tests/TestCase/Log/LogTraitTest.php
  32. +2 −2 tests/TestCase/Mailer/EmailTest.php
  33. +1 −1 tests/TestCase/Network/Http/ClientTest.php
  34. +1 −1 tests/TestCase/ORM/AssociationTest.php
  35. +13 −13 tests/TestCase/ORM/Behavior/TimestampBehaviorTest.php
  36. +1 −1 tests/TestCase/ORM/BehaviorRegistryTest.php
  37. +15 −15 tests/TestCase/ORM/BehaviorTest.php
  38. +1 −1 tests/TestCase/ORM/Locator/LocatorAwareTraitTest.php
  39. +2 −2 tests/TestCase/ORM/Locator/TableLocatorTest.php
  40. +3 −3 tests/TestCase/ORM/QueryTest.php
  41. +1 −1 tests/TestCase/ORM/ResultSetTest.php
  42. +2 −2 tests/TestCase/ORM/TableRegistryTest.php
  43. +6 −6 tests/TestCase/ORM/TableTest.php
  44. +9 −9 tests/TestCase/Routing/DispatcherTest.php
  45. +1 −1 tests/TestCase/Routing/RequestActionTraitTest.php
  46. +1 −1 tests/TestCase/Shell/I18nShellTest.php
  47. +2 −2 tests/TestCase/Shell/OrmCacheShellTest.php
  48. +1 −1 tests/TestCase/Shell/PluginShellTest.php
  49. +1 −1 tests/TestCase/Shell/ServerShellTest.php
  50. +8 −8 tests/TestCase/TestSuite/FixtureManagerTest.php
  51. +1 −1 tests/TestCase/TestSuite/TestCaseTest.php
  52. +8 −8 tests/TestCase/View/CellTest.php
  53. +6 −6 tests/TestCase/View/Helper/FormHelperTest.php
  54. +1 −1 tests/TestCase/View/HelperTest.php
  55. +3 −3 tests/TestCase/View/ViewBuilderTest.php
  56. +13 −13 tests/TestCase/View/ViewTest.php
  57. +1 −1 tests/TestCase/View/Widget/BasicWidgetTest.php
  58. +1 −1 tests/TestCase/View/Widget/ButtonWidgetTest.php
  59. +1 −1 tests/TestCase/View/Widget/CheckboxWidgetTest.php
  60. +1 −1 tests/TestCase/View/Widget/DateTimeWidgetTest.php
  61. +1 −1 tests/TestCase/View/Widget/FileWidgetTest.php
  62. +1 −1 tests/TestCase/View/Widget/LabelWidgetTest.php
  63. +1 −1 tests/TestCase/View/Widget/MultiCheckboxWidgetTest.php
  64. +1 −1 tests/TestCase/View/Widget/RadioWidgetTest.php
  65. +1 −1 tests/TestCase/View/Widget/SelectBoxWidgetTest.php
  66. +1 −1 tests/TestCase/View/Widget/TextareaWidgetTest.php
@@ -154,7 +154,7 @@ public function testFindShellAliasedAppShadow()
*/
public function testDispatchShellWithAbort()
{
$io = $this->getMock('Cake\Console\ConsoleIo');
$io = $this->getMockBuilder('Cake\Console\ConsoleIo')->getMock();
$shell = $this->getMock('Cake\Console\Shell', ['main'], [$io]);
$shell->expects($this->once())
->method('main')
@@ -181,7 +181,7 @@ public function testDispatchShellWithAbort()
public function testDispatchShellWithMain()
{
$dispatcher = $this->getMock('Cake\Console\ShellDispatcher', ['findShell']);
$Shell = $this->getMock('Cake\Console\Shell');
$Shell = $this->getMockBuilder('Cake\Console\Shell')->getMock();
$Shell->expects($this->exactly(2))->method('initialize');
$Shell->expects($this->at(0))->method('runCommand')
@@ -213,7 +213,7 @@ public function testDispatchShellWithMain()
public function testDispatchShellWithoutMain()
{
$dispatcher = $this->getMock('Cake\Console\ShellDispatcher', ['findShell']);
$Shell = $this->getMock('Cake\Console\Shell');
$Shell = $this->getMockBuilder('Cake\Console\Shell')->getMock();
$Shell->expects($this->once())->method('initialize');
$Shell->expects($this->once())->method('runCommand')
@@ -241,7 +241,7 @@ public function testDispatchShortPluginAlias()
'Cake\Console\ShellDispatcher',
['_shellExists', '_createShell']
);
$Shell = $this->getMock('Cake\Console\Shell');
$Shell = $this->getMockBuilder('Cake\Console\Shell')->getMock();
$dispatcher->expects($this->at(1))
->method('_shellExists')
@@ -269,7 +269,7 @@ public function testDispatchShortPluginAliasCamelized()
'Cake\Console\ShellDispatcher',
['_shellExists', '_createShell']
);
$Shell = $this->getMock('Cake\Console\Shell');
$Shell = $this->getMockBuilder('Cake\Console\Shell')->getMock();
$dispatcher->expects($this->at(1))
->method('_shellExists')
@@ -297,7 +297,7 @@ public function testDispatchShortPluginAliasConflict()
'Cake\Console\ShellDispatcher',
['_shellExists', '_createShell']
);
$Shell = $this->getMock('Cake\Console\Shell');
$Shell = $this->getMockBuilder('Cake\Console\Shell')->getMock();
$dispatcher->expects($this->at(1))
->method('_shellExists')
@@ -682,7 +682,7 @@ public function testHasMethod()
*/
public function testRunCommandMain()
{
$io = $this->getMock('Cake\Console\ConsoleIo');
$io = $this->getMockBuilder('Cake\Console\ConsoleIo')->getMock();
$shell = $this->getMock('Cake\Console\Shell', ['main', 'startup'], [$io]);
$shell->expects($this->once())->method('startup');
@@ -701,7 +701,7 @@ public function testRunCommandMain()
*/
public function testRunCommandWithMethod()
{
$io = $this->getMock('Cake\Console\ConsoleIo');
$io = $this->getMockBuilder('Cake\Console\ConsoleIo')->getMock();
$shell = $this->getMock('Cake\Console\Shell', ['hitMe', 'startup'], [$io]);
$shell->expects($this->once())->method('startup');
@@ -724,7 +724,7 @@ public function testRunCommandWithMethod()
public function testRunCommandWithExtra()
{
$Parser = $this->getMock('Cake\Console\ConsoleOptionParser', ['help'], ['knife']);
$io = $this->getMock('Cake\Console\ConsoleIo');
$io = $this->getMockBuilder('Cake\Console\ConsoleIo')->getMock();
$Shell = $this->getMock('Cake\Console\Shell', ['getOptionParser', 'slice', '_welcome', 'param'], [$io]);
$Parser->addSubCommand('slice');
$Shell->expects($this->once())
@@ -865,7 +865,7 @@ public function testDispatchShell()
*/
public function testRunCommandAutoMethodOff()
{
$io = $this->getMock('Cake\Console\ConsoleIo');
$io = $this->getMockBuilder('Cake\Console\ConsoleIo')->getMock();
$shell = $this->getMock('Cake\Console\Shell', ['hit_me', 'startup'], [$io]);
$shell->expects($this->never())->method('startup');
@@ -886,7 +886,7 @@ public function testRunCommandAutoMethodOff()
public function testRunCommandWithMethodNotInSubcommands()
{
$parser = $this->getMock('Cake\Console\ConsoleOptionParser', ['help'], ['knife']);
$io = $this->getMock('Cake\Console\ConsoleIo');
$io = $this->getMockBuilder('Cake\Console\ConsoleIo')->getMock();
$shell = $this->getMock('Cake\Console\Shell', ['getOptionParser', 'roll', 'startup'], [$io]);
$parser->addSubCommand('slice');
@@ -913,7 +913,7 @@ public function testRunCommandWithMethodNotInSubcommands()
public function testRunCommandWithMethodInSubcommands()
{
$parser = $this->getMock('Cake\Console\ConsoleOptionParser', ['help'], ['knife']);
$io = $this->getMock('Cake\Console\ConsoleIo');
$io = $this->getMockBuilder('Cake\Console\ConsoleIo')->getMock();
$shell = $this->getMock('Cake\Console\Shell', ['getOptionParser', 'slice', 'startup'], [$io]);
$parser->addSubCommand('slice');
@@ -940,7 +940,7 @@ public function testRunCommandWithMissingMethodInSubcommands()
$parser = $this->getMock('Cake\Console\ConsoleOptionParser', ['help'], ['knife']);
$parser->addSubCommand('slice');
$io = $this->getMock('Cake\Console\ConsoleIo');
$io = $this->getMockBuilder('Cake\Console\ConsoleIo')->getMock();
$shell = $this->getMock('Cake\Console\Shell', ['getOptionParser', 'startup'], [$io]);
$shell->expects($this->any())
->method('getOptionParser')
@@ -1058,7 +1058,7 @@ public function testRunCommandHittingTaskInSubcommand()
{
$parser = new ConsoleOptionParser('knife');
$parser->addSubcommand('slice');
$io = $this->getMock('Cake\Console\ConsoleIo');
$io = $this->getMockBuilder('Cake\Console\ConsoleIo')->getMock();
$shell = $this->getMock('Cake\Console\Shell', ['hasTask', 'startup', 'getOptionParser'], [], '', false);
$shell->io($io);
@@ -466,7 +466,7 @@ public function testValidateSortInvalid()
*/
public function testValidateSortInvalidDirection()
{
$model = $this->getMock('Cake\ORM\Table');
$model = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$model->expects($this->any())
->method('alias')
->will($this->returnValue('model'));
@@ -527,7 +527,7 @@ public function testOutOfVeryBigPageNumberGetsClamped()
*/
public function testValidateSortWhitelistFailure()
{
$model = $this->getMock('Cake\ORM\Table');
$model = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$model->expects($this->any())
->method('alias')
->will($this->returnValue('model'));
@@ -550,7 +550,7 @@ public function testValidateSortWhitelistFailure()
*/
public function testValidateSortWhitelistTrusted()
{
$model = $this->getMock('Cake\ORM\Table');
$model = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$model->expects($this->any())
->method('alias')
->will($this->returnValue('model'));
@@ -580,7 +580,7 @@ public function testValidateSortWhitelistTrusted()
*/
public function testValidateSortWhitelistEmpty()
{
$model = $this->getMock('Cake\ORM\Table');
$model = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$model->expects($this->any())
->method('alias')
->will($this->returnValue('model'));
@@ -608,7 +608,7 @@ public function testValidateSortWhitelistEmpty()
*/
public function testValidateSortWhitelistNotInSchema()
{
$model = $this->getMock('Cake\ORM\Table');
$model = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$model->expects($this->any())
->method('alias')
->will($this->returnValue('model'));
@@ -637,7 +637,7 @@ public function testValidateSortWhitelistNotInSchema()
*/
public function testValidateSortWhitelistMultiple()
{
$model = $this->getMock('Cake\ORM\Table');
$model = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$model->expects($this->any())
->method('alias')
->will($this->returnValue('model'));
@@ -668,7 +668,7 @@ public function testValidateSortWhitelistMultiple()
*/
public function testValidateSortMultiple()
{
$model = $this->getMock('Cake\ORM\Table');
$model = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$model->expects($this->any())
->method('alias')
->will($this->returnValue('model'));
@@ -696,7 +696,7 @@ public function testValidateSortMultiple()
*/
public function testValidateSortWithString()
{
$model = $this->getMock('Cake\ORM\Table');
$model = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$model->expects($this->any())
->method('alias')
->will($this->returnValue('model'));
@@ -718,7 +718,7 @@ public function testValidateSortWithString()
*/
public function testValidateSortNoSort()
{
$model = $this->getMock('Cake\ORM\Table');
$model = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$model->expects($this->any())
->method('alias')
->will($this->returnValue('model'));
@@ -740,7 +740,7 @@ public function testValidateSortNoSort()
*/
public function testValidateSortInvalidAlias()
{
$model = $this->getMock('Cake\ORM\Table');
$model = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$model->expects($this->any())
->method('alias')
->will($this->returnValue('model'));
@@ -598,7 +598,7 @@ public function testAjaxRedirectWithNoUrl()
{
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
$event = new Event('Controller.startup', $this->Controller);
$this->Controller->response = $this->getMock('Cake\Network\Response');
$this->Controller->response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$this->Controller->response->expects($this->never())
->method('body');
@@ -108,7 +108,7 @@ public function testLoadWithAlias()
*/
public function testLoadWithEnableFalse()
{
$mock = $this->getMock('Cake\Event\EventManager');
$mock = $this->getMockBuilder('Cake\Event\EventManager')->getMock();
$mock->expects($this->never())
->method('attach');
@@ -78,7 +78,7 @@ public function testNestedComponentLoading()
*/
public function testInnerComponentsAreNotEnabled()
{
$mock = $this->getMock('Cake\Event\EventManager');
$mock = $this->getMockBuilder('Cake\Event\EventManager')->getMock();
$controller = new Controller();
$controller->eventManager($mock);
@@ -272,7 +272,7 @@ public function tearDown()
public function testTableAutoload()
{
$request = new Request('controller_posts/index');
$response = $this->getMock('Cake\Network\Response');
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$Controller = new Controller($request, $response);
$Controller->modelClass = 'SiteArticles';
@@ -300,7 +300,7 @@ public function testTableAutoload()
public function testLoadModel()
{
$request = new Request('controller_posts/index');
$response = $this->getMock('Cake\Network\Response');
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$Controller = new Controller($request, $response);
$this->assertFalse(isset($Controller->Articles));
@@ -652,7 +652,7 @@ public function testSetAction()
*/
public function testStartupProcess()
{
$eventManager = $this->getMock('Cake\Event\EventManager');
$eventManager = $this->getMockBuilder('Cake\Event\EventManager')->getMock();
$controller = new Controller(null, null, null, $eventManager);
$eventManager->expects($this->at(0))->method('dispatch')
@@ -685,7 +685,7 @@ public function testStartupProcess()
*/
public function testShutdownProcess()
{
$eventManager = $this->getMock('Cake\Event\EventManager');
$eventManager = $this->getMockBuilder('Cake\Event\EventManager')->getMock();
$controller = new Controller(null, null, null, $eventManager);
$eventManager->expects($this->once())->method('dispatch')
@@ -761,7 +761,7 @@ public function testInvokeActionMissingAction()
{
$url = new Request('test/missing');
$url->addParams(['controller' => 'Test', 'action' => 'missing']);
$response = $this->getMock('Cake\Network\Response');
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$Controller = new TestController($url, $response);
$Controller->invokeAction();
@@ -778,7 +778,7 @@ public function testInvokeActionPrivate()
{
$url = new Request('test/private_m/');
$url->addParams(['controller' => 'Test', 'action' => 'private_m']);
$response = $this->getMock('Cake\Network\Response');
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$Controller = new TestController($url, $response);
$Controller->invokeAction();
@@ -795,7 +795,7 @@ public function testInvokeActionProtected()
{
$url = new Request('test/protected_m/');
$url->addParams(['controller' => 'Test', 'action' => 'protected_m']);
$response = $this->getMock('Cake\Network\Response');
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$Controller = new TestController($url, $response);
$Controller->invokeAction();
@@ -812,7 +812,7 @@ public function testInvokeActionBaseMethods()
{
$url = new Request('test/redirect/');
$url->addParams(['controller' => 'Test', 'action' => 'redirect']);
$response = $this->getMock('Cake\Network\Response');
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$Controller = new TestController($url, $response);
$Controller->invokeAction();
@@ -831,7 +831,7 @@ public function testInvokeActionReturnValue()
'action' => 'returner',
'pass' => []
]);
$response = $this->getMock('Cake\Network\Response');
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$Controller = new TestController($url, $response);
$result = $Controller->invokeAction();
@@ -849,7 +849,7 @@ public function testViewPathConventions()
$request->addParams([
'prefix' => 'admin'
]);
$response = $this->getMock('Cake\Network\Response');
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$Controller = new \TestApp\Controller\Admin\PostsController($request, $response);
$Controller->eventManager()->on('Controller.beforeRender', function (Event $e) {
return $e->subject()->response;
@@ -860,7 +860,7 @@ public function testViewPathConventions()
$request->addParams([
'prefix' => 'admin/super'
]);
$response = $this->getMock('Cake\Network\Response');
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$Controller = new \TestApp\Controller\Admin\PostsController($request, $response);
$Controller->eventManager()->on('Controller.beforeRender', function (Event $e) {
return $e->subject()->response;
@@ -888,7 +888,7 @@ public function testViewPathConventions()
public function testComponents()
{
$request = new Request('/');
$response = $this->getMock('Cake\Network\Response');
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$controller = new TestController($request, $response);
$this->assertInstanceOf('Cake\Controller\ComponentRegistry', $controller->components());
@@ -905,7 +905,7 @@ public function testComponents()
public function testComponentsWithCustomRegistry()
{
$request = new Request('/');
$response = $this->getMock('Cake\Network\Response');
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$componentRegistry = $this->getMock('Cake\Controller\ComponentRegistry', ['offsetGet']);
$controller = new TestController($request, $response, null, null, $componentRegistry);
@@ -923,7 +923,7 @@ public function testComponentsWithCustomRegistry()
public function testLoadComponent()
{
$request = new Request('/');
$response = $this->getMock('Cake\Network\Response');
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$controller = new TestController($request, $response);
$result = $controller->loadComponent('Paginator');
@@ -942,7 +942,7 @@ public function testLoadComponent()
public function testLoadComponentDuplicate()
{
$request = new Request('/');
$response = $this->getMock('Cake\Network\Response');
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$controller = new TestController($request, $response);
$this->assertNotEmpty($controller->loadComponent('Paginator'));
@@ -963,7 +963,7 @@ public function testLoadComponentDuplicate()
public function testIsAction()
{
$request = new Request('/');
$response = $this->getMock('Cake\Network\Response');
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$controller = new TestController($request, $response);
$this->assertFalse($controller->isAction('redirect'));
Oops, something went wrong.

0 comments on commit 3cc1f9a

Please sign in to comment.
You can’t perform that action at this time.