diff --git a/src/Shell/Task/TestTask.php b/src/Shell/Task/TestTask.php index 0b004c794..ef9ba745d 100644 --- a/src/Shell/Task/TestTask.php +++ b/src/Shell/Task/TestTask.php @@ -530,16 +530,18 @@ public function generateConstructor($type, $fullClassName) $construct = "new {$className}(\$registry);"; } if ($type === 'shell') { - $pre = "\$this->io = \$this->getMock('Cake\Console\ConsoleIo');"; + $pre = "\$this->io = \$this->getMockBuilder('Cake\Console\ConsoleIo')->getMock();"; $construct = "new {$className}(\$this->io);"; } if ($type === 'task') { - $pre = "\$this->io = \$this->getMock('Cake\Console\ConsoleIo');\n"; - $construct = "\$this->getMock('{$fullClassName}', [], [\$this->io]);"; + $pre = "\$this->io = \$this->getMockBuilder('Cake\Console\ConsoleIo')->getMock();\n"; + $construct = "\$this->getMockBuilder('{$fullClassName}')\n"; + $construct .= " ->setConstructorArgs([\$this->io])\n"; + $construct .= " ->getMock();"; } if ($type === 'cell') { - $pre = "\$this->request = \$this->getMock('Cake\Network\Request');\n"; - $pre .= " \$this->response = \$this->getMock('Cake\Network\Response');"; + $pre = "\$this->request = \$this->getMockBuilder('Cake\Network\Request')->getMock();\n"; + $pre .= " \$this->response = \$this->getMockBuilder('Cake\Network\Response')->getMock();"; $construct = "new {$className}(\$this->request, \$this->response);"; } if ($type === 'shell_helper') { diff --git a/tests/TestCase/Shell/BakeShellTest.php b/tests/TestCase/Shell/BakeShellTest.php index d3f0a9678..180ab78c5 100644 --- a/tests/TestCase/Shell/BakeShellTest.php +++ b/tests/TestCase/Shell/BakeShellTest.php @@ -55,11 +55,11 @@ public function setUp() $this->out = new ConsoleOutput(); $this->io = new ConsoleIo($this->out); - $this->Shell = $this->getMock( - 'Bake\Shell\BakeShell', - ['in', 'createFile', '_stop'], - [$this->io] - ); + $this->Shell = $this->getMockBuilder('Bake\Shell\BakeShell') + ->setMethods(['in', 'createFile', '_stop']) + ->setConstructorArgs([$this->io]) + ->getMock(); + Configure::write('App.namespace', 'Bake\Test\App'); } @@ -81,9 +81,9 @@ public function tearDown() */ public function testAllWithModelName() { - $this->Shell->Model = $this->getMock('Bake\Shell\Task\ModelTask'); - $this->Shell->Controller = $this->getMock('Bake\Shell\Task\ControllerTask'); - $this->Shell->Template = $this->getMock('Bake\Shell\Task\TemplateTask'); + $this->Shell->Model = $this->getMockBuilder('Bake\Shell\Task\ModelTask')->getMock(); + $this->Shell->Controller = $this->getMockBuilder('Bake\Shell\Task\ControllerTask')->getMock(); + $this->Shell->Template = $this->getMockBuilder('Bake\Shell\Task\TemplateTask')->getMock(); $this->Shell->Model->expects($this->once()) ->method('main') diff --git a/tests/TestCase/Shell/Task/BakeTemplateTaskTest.php b/tests/TestCase/Shell/Task/BakeTemplateTaskTest.php index 591114dd4..96a2e4511 100644 --- a/tests/TestCase/Shell/Task/BakeTemplateTaskTest.php +++ b/tests/TestCase/Shell/Task/BakeTemplateTaskTest.php @@ -36,13 +36,15 @@ public function setUp() { parent::setUp(); $this->_compareBasePath = Plugin::path('Bake') . 'tests' . DS . 'comparisons' . DS . 'BakeTemplate' . DS; - $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); + $io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); - $this->Task = $this->getMock( - 'Bake\Shell\Task\BakeTemplateTask', - ['in', 'err', 'createFile', '_stop', 'clear'], - [$io] - ); + $this->Task = $this->getMockBuilder('Bake\Shell\Task\BakeTemplateTask') + ->setMethods(['in', 'err', 'createFile', '_stop', 'clear']) + ->setConstructorArgs([$io]) + ->getMock(); + ; } /** diff --git a/tests/TestCase/Shell/Task/CellTaskTest.php b/tests/TestCase/Shell/Task/CellTaskTest.php index 5af38e46f..1cd931d07 100644 --- a/tests/TestCase/Shell/Task/CellTaskTest.php +++ b/tests/TestCase/Shell/Task/CellTaskTest.php @@ -38,18 +38,19 @@ public function setUp() { parent::setUp(); $this->_compareBasePath = Plugin::path('Bake') . 'tests' . DS . 'comparisons' . DS . 'Cell' . DS; - $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); + $io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); + + $this->Task = $this->getMockBuilder('Bake\Shell\Task\CellTask') + ->setMethods(['in', 'err', 'createFile', '_stop']) + ->setConstructorArgs([$io]) + ->getMock(); + + $this->Task->Test = $this->getMockBuilder('Bake\Shell\Task\TestTask') + ->setConstructorArgs([$io]) + ->getMock(); - $this->Task = $this->getMock( - 'Bake\Shell\Task\CellTask', - ['in', 'err', 'createFile', '_stop'], - [$io] - ); - $this->Task->Test = $this->getMock( - 'Bake\Shell\Task\TestTask', - [], - [$io] - ); $this->Task->BakeTemplate = new BakeTemplateTask($io); $this->Task->BakeTemplate->initialize(); $this->Task->BakeTemplate->interactive = false; diff --git a/tests/TestCase/Shell/Task/ControllerTaskTest.php b/tests/TestCase/Shell/Task/ControllerTaskTest.php index f3fafaf0f..ed1bf3e88 100644 --- a/tests/TestCase/Shell/Task/ControllerTaskTest.php +++ b/tests/TestCase/Shell/Task/ControllerTaskTest.php @@ -52,27 +52,27 @@ public function setUp() { parent::setUp(); $this->_compareBasePath = Plugin::path('Bake') . 'tests' . DS . 'comparisons' . DS . 'Controller' . DS; - $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); - $this->Task = $this->getMock( - 'Bake\Shell\Task\ControllerTask', - ['in', 'out', 'err', 'hr', 'createFile', '_stop'], - [$io] - ); + $io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); + $this->Task = $this->getMockBuilder('Bake\Shell\Task\ControllerTask') + ->setMethods(['in', 'out', 'err', 'hr', 'createFile', '_stop']) + ->setConstructorArgs([$io]) + ->getMock(); + $this->Task->name = 'Controller'; $this->Task->connection = 'test'; $this->Task->BakeTemplate = new BakeTemplateTask($io); - $this->Task->Model = $this->getMock( - 'Bake\Shell\Task\ModelTask', - ['in', 'out', 'err', 'createFile', '_stop'], - [$io] - ); - $this->Task->Test = $this->getMock( - 'Bake\Shell\Task\TestTask', - [], - [$io] - ); + $this->Task->Model = $this->getMockBuilder('Bake\Shell\Task\ModelTask') + ->setMethods(['in', 'out', 'err', 'createFile', '_stop']) + ->setConstructorArgs([$io]) + ->getMock(); + + $this->Task->Test = $this->getMockBuilder('Bake\Shell\Task\TestTask') + ->setConstructorArgs([$io]) + ->getMock(); TableRegistry::get('BakeArticles', [ 'className' => __NAMESPACE__ . '\BakeArticlesTable' diff --git a/tests/TestCase/Shell/Task/FixtureTaskTest.php b/tests/TestCase/Shell/Task/FixtureTaskTest.php index 93274a686..f04e2c610 100644 --- a/tests/TestCase/Shell/Task/FixtureTaskTest.php +++ b/tests/TestCase/Shell/Task/FixtureTaskTest.php @@ -52,18 +52,18 @@ class FixtureTaskTest extends TestCase public function setUp() { parent::setUp(); - $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); - - $this->Task = $this->getMock( - 'Bake\Shell\Task\FixtureTask', - ['in', 'err', 'createFile', '_stop', 'clear'], - [$io] - ); - $this->Task->Model = $this->getMock( - 'Bake\Shell\Task\ModelTask', - ['in', 'out', 'err', 'createFile', 'getName', 'getTable', 'listUnskipped'], - [$io] - ); + $io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); + + $this->Task = $this->getMockBuilder('Bake\Shell\Task\FixtureTask') + ->setMethods(['in', 'err', 'createFile', '_stop', 'clear']) + ->setConstructorArgs([$io]) + ->getMock(); + $this->Task->Model = $this->getMockBuilder('Bake\Shell\Task\ModelTask') + ->setMethods(['in', 'out', 'err', 'createFile', 'getName', 'getTable', 'listUnskipped']) + ->setConstructorArgs([$io]) + ->getMock(); $this->Task->BakeTemplate = new BakeTemplateTask($io); $this->Task->BakeTemplate->interactive = false; $this->Task->BakeTemplate->initialize(); diff --git a/tests/TestCase/Shell/Task/MailerTaskTest.php b/tests/TestCase/Shell/Task/MailerTaskTest.php index a2af6a7d5..08dd884e3 100644 --- a/tests/TestCase/Shell/Task/MailerTaskTest.php +++ b/tests/TestCase/Shell/Task/MailerTaskTest.php @@ -38,18 +38,20 @@ public function setUp() { parent::setUp(); $this->_compareBasePath = Plugin::path('Bake') . 'tests' . DS . 'comparisons' . DS . 'Mailer' . DS; - $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); - - $this->Task = $this->getMock( - 'Bake\Shell\Task\MailerTask', - ['in', 'err', 'createFile', '_stop'], - [$io] - ); - $this->Task->Test = $this->getMock( - 'Bake\Shell\Task\TestTask', - [], - [$io] - ); + $io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); + + + $this->Task = $this->getMockBuilder('Bake\Shell\Task\MailerTask') + ->setMethods(['in', 'err', 'createFile', '_stop']) + ->setConstructorArgs([$io]) + ->getMock(); + + $this->Task->Test = $this->getMockBuilder('Bake\Shell\Task\TestTask') + ->setConstructorArgs([$io]) + ->getMock(); + $this->Task->BakeTemplate = new BakeTemplateTask($io); $this->Task->BakeTemplate->initialize(); $this->Task->BakeTemplate->interactive = false; diff --git a/tests/TestCase/Shell/Task/ModelTaskAssociationDetectionTest.php b/tests/TestCase/Shell/Task/ModelTaskAssociationDetectionTest.php index c209adf41..ed2ae8b42 100644 --- a/tests/TestCase/Shell/Task/ModelTaskAssociationDetectionTest.php +++ b/tests/TestCase/Shell/Task/ModelTaskAssociationDetectionTest.php @@ -56,13 +56,15 @@ public function setUp() { parent::setUp(); $this->_compareBasePath = Plugin::path('Bake') . 'tests' . DS . 'comparisons' . DS . 'Model' . DS; - $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); + $io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); + + $this->Task = $this->getMockBuilder('Bake\Shell\Task\ModelTask') + ->setMethods(['in', 'err', 'createFile', '_stop', '_checkUnitTest']) + ->setConstructorArgs([$io]) + ->getMock(); - $this->Task = $this->getMock( - 'Bake\Shell\Task\ModelTask', - ['in', 'err', 'createFile', '_stop', '_checkUnitTest'], - [$io] - ); $this->Task->connection = 'default'; $this->_setupOtherMocks(); TableRegistry::clear(); @@ -75,13 +77,15 @@ public function setUp() */ protected function _useMockedOut() { - $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); + $io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); + + $this->Task = $this->getMockBuilder('Bake\Shell\Task\ModelTask') + ->setMethods(['in', 'out', 'err', 'hr', 'createFile', '_stop', '_checkUnitTest']) + ->setConstructorArgs([$io]) + ->getMock(); - $this->Task = $this->getMock( - 'Bake\Shell\Task\ModelTask', - ['in', 'out', 'err', 'hr', 'createFile', '_stop', '_checkUnitTest'], - [$io] - ); $this->_setupOtherMocks(); } @@ -92,10 +96,16 @@ protected function _useMockedOut() */ protected function _setupOtherMocks() { - $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); - - $this->Task->Fixture = $this->getMock('Bake\Shell\Task\FixtureTask', [], [$io]); - $this->Task->Test = $this->getMock('Bake\Shell\Task\FixtureTask', [], [$io]); + $io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); + + $this->Task->Fixture = $this->getMockBuilder('Bake\Shell\Task\FixtureTask') + ->setConstructorArgs([$io]) + ->getMock(); + $this->Task->Test = $this->getMockBuilder('Bake\Shell\Task\FixtureTask') + ->setConstructorArgs([$io]) + ->getMock(); $this->Task->BakeTemplate = new BakeTemplateTask($io); $this->Task->BakeTemplate->interactive = false; diff --git a/tests/TestCase/Shell/Task/ModelTaskTest.php b/tests/TestCase/Shell/Task/ModelTaskTest.php index b950c42c1..5b2afa412 100644 --- a/tests/TestCase/Shell/Task/ModelTaskTest.php +++ b/tests/TestCase/Shell/Task/ModelTaskTest.php @@ -70,13 +70,15 @@ public function setUp() { parent::setUp(); $this->_compareBasePath = Plugin::path('Bake') . 'tests' . DS . 'comparisons' . DS . 'Model' . DS; - $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); + $io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); + + $this->Task = $this->getMockBuilder('Bake\Shell\Task\ModelTask') + ->setMethods(['in', 'err', 'createFile', '_stop', '_checkUnitTest']) + ->setConstructorArgs([$io]) + ->getMock(); - $this->Task = $this->getMock( - 'Bake\Shell\Task\ModelTask', - ['in', 'err', 'createFile', '_stop', '_checkUnitTest'], - [$io] - ); $this->Task->connection = 'test'; $this->_setupOtherMocks(); TableRegistry::clear(); @@ -89,13 +91,15 @@ public function setUp() */ protected function _useMockedOut() { - $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); + $io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); + + $this->Task = $this->getMockBuilder('Bake\Shell\Task\ModelTask') + ->setMethods(['in', 'out', 'err', 'hr', 'createFile', '_stop', '_checkUnitTest']) + ->setConstructorArgs([$io]) + ->getMock(); - $this->Task = $this->getMock( - 'Bake\Shell\Task\ModelTask', - ['in', 'out', 'err', 'hr', 'createFile', '_stop', '_checkUnitTest'], - [$io] - ); $this->_setupOtherMocks(); } @@ -106,10 +110,16 @@ protected function _useMockedOut() */ protected function _setupOtherMocks() { - $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); - - $this->Task->Fixture = $this->getMock('Bake\Shell\Task\FixtureTask', [], [$io]); - $this->Task->Test = $this->getMock('Bake\Shell\Task\FixtureTask', [], [$io]); + $io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); + + $this->Task->Fixture = $this->getMockBuilder('Bake\Shell\Task\FixtureTask') + ->setConstructorArgs([$io]) + ->getMock(); + $this->Task->Test = $this->getMockBuilder('Bake\Shell\Task\FixtureTask') + ->setConstructorArgs([$io]) + ->getMock(); $this->Task->BakeTemplate = new BakeTemplateTask($io); $this->Task->BakeTemplate->interactive = false; diff --git a/tests/TestCase/Shell/Task/PluginTaskTest.php b/tests/TestCase/Shell/Task/PluginTaskTest.php index b73af5fd3..f80f78681 100644 --- a/tests/TestCase/Shell/Task/PluginTaskTest.php +++ b/tests/TestCase/Shell/Task/PluginTaskTest.php @@ -48,13 +48,14 @@ public function setUp() { parent::setUp(); $this->_compareBasePath = Plugin::path('Bake') . 'tests' . DS . 'comparisons' . DS . 'Plugin' . DS; - $this->io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); + $this->io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); - $this->Task = $this->getMock( - 'Bake\Shell\Task\PluginTask', - ['in', 'err', '_stop', 'clear', 'callProcess', '_rootComposerFilePath', 'findComposer'], - [$this->io] - ); + $this->Task = $this->getMockBuilder('Bake\Shell\Task\PluginTask') + ->setMethods(['in', 'err', '_stop', 'clear', 'callProcess', '_rootComposerFilePath', 'findComposer']) + ->setConstructorArgs([$this->io]) + ->getMock(); $this->Task->BakeTemplate = new BakeTemplateTask($this->io); $this->Task->BakeTemplate->interactive = false; @@ -194,11 +195,11 @@ public function testFindPathNonExistent() array_unshift($paths, '/fake/path'); $paths[] = '/fake/path2'; - $this->Task = $this->getMock( - 'Bake\Shell\Task\PluginTask', - ['in', 'out', 'err', '_stop'], - [$this->io] - ); + $this->Task = $this->getMockBuilder('Bake\Shell\Task\PluginTask') + ->setMethods(['in', 'out', 'err', '_stop']) + ->setConstructorArgs([$this->io]) + ->getMock(); + $this->Task->path = TMP . 'tests' . DS; $this->Task->method('findPath') diff --git a/tests/TestCase/Shell/Task/SimpleBakeTaskTest.php b/tests/TestCase/Shell/Task/SimpleBakeTaskTest.php index 99f2e7a6b..229dbb963 100644 --- a/tests/TestCase/Shell/Task/SimpleBakeTaskTest.php +++ b/tests/TestCase/Shell/Task/SimpleBakeTaskTest.php @@ -38,18 +38,19 @@ public function setUp() { parent::setUp(); $this->_compareBasePath = Plugin::path('Bake') . 'tests' . DS . 'comparisons' . DS . 'Simple' . DS; - $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); - - $this->Task = $this->getMock( - 'Bake\Shell\Task\SimpleBakeTask', - ['in', 'err', 'createFile', '_stop', 'name', 'template', 'fileName'], - [$io] - ); - $this->Task->Test = $this->getMock( - 'Bake\Shell\Task\TestTask', - [], - [$io] - ); + $io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); + + $this->Task = $this->getMockBuilder('Bake\Shell\Task\SimpleBakeTask') + ->setMethods(['in', 'err', 'createFile', '_stop', 'name', 'template', 'fileName']) + ->setConstructorArgs([$io]) + ->getMock(); + + $this->Task->Test = $this->getMockBuilder('Bake\Shell\Task\TestTask') + ->setConstructorArgs([$io]) + ->getMock(); + $this->Task->BakeTemplate = new BakeTemplateTask($io); $this->Task->BakeTemplate->initialize(); $this->Task->BakeTemplate->interactive = false; @@ -210,7 +211,9 @@ public function subclassProvider() */ public function testImplementations($class) { - $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); + $io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); $task = new $class($io); $this->assertInternalType('string', $task->name()); $this->assertInternalType('string', $task->fileName('Example')); diff --git a/tests/TestCase/Shell/Task/TaskTaskTest.php b/tests/TestCase/Shell/Task/TaskTaskTest.php index fca16744f..ffbc587eb 100644 --- a/tests/TestCase/Shell/Task/TaskTaskTest.php +++ b/tests/TestCase/Shell/Task/TaskTaskTest.php @@ -38,18 +38,19 @@ public function setUp() { parent::setUp(); $this->_compareBasePath = Plugin::path('Bake') . 'tests' . DS . 'comparisons' . DS . 'Shell' . DS . 'Task' . DS; - $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); - - $this->Task = $this->getMock( - 'Bake\Shell\Task\TaskTask', - ['in', 'err', 'createFile', '_stop'], - [$io] - ); - $this->Task->Test = $this->getMock( - 'Bake\Shell\Task\TestTask', - [], - [$io] - ); + $io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); + + $this->Task = $this->getMockBuilder('Bake\Shell\Task\TaskTask') + ->setMethods(['in', 'err', 'createFile', '_stop']) + ->setConstructorArgs([$io]) + ->getMock(); + + $this->Task->Test = $this->getMockBuilder('Bake\Shell\Task\TestTask') + ->setConstructorArgs([$io]) + ->getMock(); + $this->Task->BakeTemplate = new BakeTemplateTask($io); $this->Task->BakeTemplate->initialize(); $this->Task->BakeTemplate->interactive = false; diff --git a/tests/TestCase/Shell/Task/TemplateTaskTest.php b/tests/TestCase/Shell/Task/TemplateTaskTest.php index 50a605d1c..8df82d416 100644 --- a/tests/TestCase/Shell/Task/TemplateTaskTest.php +++ b/tests/TestCase/Shell/Task/TemplateTaskTest.php @@ -71,15 +71,19 @@ public function setUp() */ protected function _setupTask($methods) { - $io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); + $io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); + + $this->Task = $this->getMockBuilder('Bake\Shell\Task\TemplateTask') + ->setMethods($methods) + ->setConstructorArgs([$io]) + ->getMock(); - $this->Task = $this->getMock( - 'Bake\Shell\Task\TemplateTask', - $methods, - [$io] - ); $this->Task->BakeTemplate = new BakeTemplateTask($io); - $this->Task->Model = $this->getMock('Bake\Shell\Task\ModelTask', [], [$io]); + $this->Task->Model = $this->getMockBuilder('Bake\Shell\Task\ModelTask') + ->setConstructorArgs([$io]) + ->getMock(); } /** diff --git a/tests/TestCase/Shell/Task/TestTaskTest.php b/tests/TestCase/Shell/Task/TestTaskTest.php index 2e3299a1d..800f1c4b4 100644 --- a/tests/TestCase/Shell/Task/TestTaskTest.php +++ b/tests/TestCase/Shell/Task/TestTaskTest.php @@ -63,13 +63,15 @@ public function setUp() { parent::setUp(); $this->_compareBasePath = Plugin::path('Bake') . 'tests' . DS . 'comparisons' . DS . 'Test' . DS; - $this->io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); + $this->io = $this->getMockBuilder('Cake\Console\ConsoleIo') + ->disableOriginalConstructor() + ->getMock(); + + $this->Task = $this->getMockBuilder('Bake\Shell\Task\TestTask') + ->setMethods(['in', 'err', 'createFile', '_stop', 'isLoadableClass']) + ->setConstructorArgs([$this->io]) + ->getMock(); - $this->Task = $this->getMock( - 'Bake\Shell\Task\TestTask', - ['in', 'err', 'createFile', '_stop', 'isLoadableClass'], - [$this->io] - ); $this->Task->name = 'Test'; $this->Task->BakeTemplate = new BakeTemplateTask($this->io); $this->Task->BakeTemplate->interactive = false; diff --git a/tests/comparisons/Test/testBakeCellTest.php b/tests/comparisons/Test/testBakeCellTest.php index ee49fd089..8bfab751c 100644 --- a/tests/comparisons/Test/testBakeCellTest.php +++ b/tests/comparisons/Test/testBakeCellTest.php @@ -39,8 +39,8 @@ class ArticlesCellTest extends TestCase public function setUp() { parent::setUp(); - $this->request = $this->getMock('Cake\Network\Request'); - $this->response = $this->getMock('Cake\Network\Response'); + $this->request = $this->getMockBuilder('Cake\Network\Request')->getMock(); + $this->response = $this->getMockBuilder('Cake\Network\Response')->getMock(); $this->Articles = new ArticlesCell($this->request, $this->response); } diff --git a/tests/comparisons/Test/testBakeShellTaskTest.php b/tests/comparisons/Test/testBakeShellTaskTest.php index d788001ce..2edbea755 100644 --- a/tests/comparisons/Test/testBakeShellTaskTest.php +++ b/tests/comparisons/Test/testBakeShellTaskTest.php @@ -32,9 +32,11 @@ class ArticlesTaskTest extends TestCase public function setUp() { parent::setUp(); - $this->io = $this->getMock('Cake\Console\ConsoleIo'); + $this->io = $this->getMockBuilder('Cake\Console\ConsoleIo')->getMock(); - $this->Articles = $this->getMock('App\Shell\Task\ArticlesTask', [], [$this->io]); + $this->Articles = $this->getMockBuilder('App\Shell\Task\ArticlesTask') + ->setConstructorArgs([$this->io]) + ->getMock(); } /** diff --git a/tests/comparisons/Test/testBakeShellTest.php b/tests/comparisons/Test/testBakeShellTest.php index e66d8a195..655f9c25d 100644 --- a/tests/comparisons/Test/testBakeShellTest.php +++ b/tests/comparisons/Test/testBakeShellTest.php @@ -32,7 +32,7 @@ class ArticlesShellTest extends TestCase public function setUp() { parent::setUp(); - $this->io = $this->getMock('Cake\Console\ConsoleIo'); + $this->io = $this->getMockBuilder('Cake\Console\ConsoleIo')->getMock(); $this->Articles = new ArticlesShell($this->io); }