From 5a6a74e2f8bbc329eb25926fce61ef55596604b1 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 20 Mar 2015 20:35:30 -0400 Subject: [PATCH] Fix failing tests. The test was taking the wrong index when creating mock path choices. Refs #6125 --- lib/Cake/Console/Command/Task/PluginTask.php | 2 -- .../Case/Console/Command/Task/PluginTaskTest.php | 16 +++++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/Cake/Console/Command/Task/PluginTask.php b/lib/Cake/Console/Command/Task/PluginTask.php index 95c3b3039..7cd507942 100644 --- a/lib/Cake/Console/Command/Task/PluginTask.php +++ b/lib/Cake/Console/Command/Task/PluginTask.php @@ -1,7 +1,5 @@ _testPath = array_push($paths, TMP . 'tests' . DS); + $this->_testPath = array_push($paths, TMP . 'tests' . DS) - 1; App::build(array('plugins' => $paths)); } @@ -80,17 +80,23 @@ class PluginTaskTest extends CakeTestCase { * @return void */ public function testBakeFoldersAndFiles() { - $this->Task->expects($this->at(0))->method('in')->will($this->returnValue($this->_testPath)); - $this->Task->expects($this->at(1))->method('in')->will($this->returnValue('y')); + $this->Task->expects($this->at(0)) + ->method('in') + ->will($this->returnValue($this->_testPath)); + $this->Task->expects($this->at(1)) + ->method('in') + ->will($this->returnValue('y')); $path = $this->Task->path . 'BakeTestPlugin'; $file = $path . DS . 'Controller' . DS . 'BakeTestPluginAppController.php'; - $this->Task->expects($this->at(2))->method('createFile') + $this->Task->expects($this->at(2)) + ->method('createFile') ->with($file, new PHPUnit_Framework_Constraint_IsAnything()); $file = $path . DS . 'Model' . DS . 'BakeTestPluginAppModel.php'; - $this->Task->expects($this->at(3))->method('createFile') + $this->Task->expects($this->at(3)) + ->method('createFile') ->with($file, new PHPUnit_Framework_Constraint_IsAnything()); $this->Task->bake('BakeTestPlugin');