Fix failing tests.

The test was taking the wrong index when creating mock path choices.

Refs #6125
This commit is contained in:
mark_story 2015-03-20 20:35:30 -04:00
parent 0003296f42
commit 5a6a74e2f8
2 changed files with 11 additions and 7 deletions

View file

@ -1,7 +1,5 @@
<?php <?php
/** /**
* The Plugin Task handles creating an empty plugin, ready to be used
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* *

View file

@ -58,7 +58,7 @@ class PluginTaskTest extends CakeTestCase {
array_splice($paths, $i, 1); array_splice($paths, $i, 1);
} }
} }
$this->_testPath = array_push($paths, TMP . 'tests' . DS); $this->_testPath = array_push($paths, TMP . 'tests' . DS) - 1;
App::build(array('plugins' => $paths)); App::build(array('plugins' => $paths));
} }
@ -80,17 +80,23 @@ class PluginTaskTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testBakeFoldersAndFiles() { public function testBakeFoldersAndFiles() {
$this->Task->expects($this->at(0))->method('in')->will($this->returnValue($this->_testPath)); $this->Task->expects($this->at(0))
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue('y')); ->method('in')
->will($this->returnValue($this->_testPath));
$this->Task->expects($this->at(1))
->method('in')
->will($this->returnValue('y'));
$path = $this->Task->path . 'BakeTestPlugin'; $path = $this->Task->path . 'BakeTestPlugin';
$file = $path . DS . 'Controller' . DS . 'BakeTestPluginAppController.php'; $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()); ->with($file, new PHPUnit_Framework_Constraint_IsAnything());
$file = $path . DS . 'Model' . DS . 'BakeTestPluginAppModel.php'; $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()); ->with($file, new PHPUnit_Framework_Constraint_IsAnything());
$this->Task->bake('BakeTestPlugin'); $this->Task->bake('BakeTestPlugin');