Browse Source

Update other bake tasks to use newer style path generation.

Fix incorrect help text.
mark_story 12 years ago
parent
commit
b7593dff83

+ 3 - 5
src/Console/Command/Task/ControllerTask.php

@@ -34,13 +34,11 @@ class ControllerTask extends BakeTask {
 	public $tasks = ['Model', 'Test', 'Template'];
 
 /**
- * Override initialize
+ * Path fragment for generated code.
  *
- * @return void
+ * @var string
  */
-	public function initialize() {
-		$this->path = current(App::path('Controller'));
-	}
+	public $pathFragment = 'Controller/';
 
 /**
  * Execution method always used for tasks

+ 9 - 27
src/Console/Command/Task/FixtureTask.php

@@ -37,22 +37,17 @@ class FixtureTask extends BakeTask {
 	public $tasks = ['Model', 'Template'];
 
 /**
- * path to fixtures directory
+ * Get the file path.
  *
- * @var string
+ * @return string
  */
-	public $path = null;
-
-/**
- * Override initialize
- *
- * @param \Cake\Console\ConsoleOutput $stdout A ConsoleOutput object for stdout.
- * @param \Cake\Console\ConsoleOutput $stderr A ConsoleOutput object for stderr.
- * @param \Cake\Console\ConsoleInput $stdin A ConsoleInput object for stdin.
- */
-	public function __construct(ConsoleOutput $stdout = null, ConsoleOutput $stderr = null, ConsoleInput $stdin = null) {
-		parent::__construct($stdout, $stderr, $stdin);
-		$this->path = ROOT . DS . 'Test' . DS . 'Fixture' . DS;
+	public function getPath() {
+		$dir = 'Test/Fixture/';
+		$path = ROOT . DS . $dir;
+		if (isset($this->plugin)) {
+			$path = $this->_pluginPath($this->plugin) . $dir;
+		}
+		return $path;
 	}
 
 /**
@@ -266,19 +261,6 @@ class FixtureTask extends BakeTask {
 	}
 
 /**
- * Get the path to the fixtures.
- *
- * @return string Path for the fixtures
- */
-	public function getPath() {
-		$path = $this->path;
-		if (isset($this->plugin)) {
-			$path = $this->_pluginPath($this->plugin) . 'Test/Fixture/';
-		}
-		return $path;
-	}
-
-/**
  * Generates a string representation of a schema.
  *
  * @param \Cake\Database\Schema\Table $table Table schema

+ 1 - 10
src/Console/Command/Task/ModelTask.php

@@ -33,7 +33,7 @@ class ModelTask extends BakeTask {
  *
  * @var string
  */
-	public $path = null;
+	public $pathFragment = 'Model/';
 
 /**
  * tasks
@@ -71,15 +71,6 @@ class ModelTask extends BakeTask {
 	protected $_validations = [];
 
 /**
- * Override initialize
- *
- * @return void
- */
-	public function initialize() {
-		$this->path = APP . 'Model' . DS;
-	}
-
-/**
  * Execution method always used for tasks
  *
  * @return void

+ 6 - 1
src/Console/Command/Task/SimpleBakeTask.php

@@ -116,7 +116,12 @@ class SimpleBakeTask extends BakeTask {
 		$parser->description(
 			__d('cake_console', 'Bake a %s class file.', $this->name)
 		)->addArgument('name', [
-			'help' => __d('cake_console', 'Name of the %s to bake. Can use Plugin.name to bake controllers into plugins.', $this->name)
+			'help' => __d(
+				'cake_console',
+				'Name of the %s to bake. Can use Plugin.name to bake %s files into plugins.',
+				$this->name,
+				$this->name
+			)
 		])->addOption('plugin', [
 			'short' => 'p',
 			'help' => __d('cake_console', 'Plugin to bake the %s into.', $this->name)

+ 15 - 9
src/Console/Command/Task/TestTask.php

@@ -33,13 +33,6 @@ use Cake\Utility\Inflector;
 class TestTask extends BakeTask {
 
 /**
- * path to TESTS directory
- *
- * @var string
- */
-	public $path = TESTS;
-
-/**
  * Tasks used.
  *
  * @var array
@@ -465,6 +458,20 @@ class TestTask extends BakeTask {
 	}
 
 /**
+ * Get the file path.
+ *
+ * @return string
+ */
+	public function getPath() {
+		$dir = 'Test/TestCase/';
+		$path = ROOT . DS . $dir;
+		if (isset($this->plugin)) {
+			$path = $this->_pluginPath($this->plugin) . $dir;
+		}
+		return $path;
+	}
+
+/**
  * Make the filename for the test case. resolve the suffixes for controllers
  * and get the plugin path if needed.
  *
@@ -473,8 +480,7 @@ class TestTask extends BakeTask {
  * @return string filename the test should be created on.
  */
 	public function testCaseFileName($type, $className) {
-		$path = $this->getPath() . 'TestCase/';
-
+		$path = $this->getPath();
 		$namespace = Configure::read('App.namespace');
 		if ($this->plugin) {
 			$namespace = Plugin::getNamespace($this->plugin);

+ 1 - 8
src/Console/Command/Task/ViewTask.php

@@ -39,7 +39,7 @@ class ViewTask extends BakeTask {
  *
  * @var array
  */
-	public $path = null;
+	public $pathFragment = 'Template/';
 
 /**
  * Name of the controller being used
@@ -85,13 +85,6 @@ class ViewTask extends BakeTask {
 	public $noTemplateActions = ['delete'];
 
 /**
- * Override the name so the base class can do the right thing.
- *
- * @var string
- */
-	public $name = 'Template';
-
-/**
  * Override initialize
  *
  * @return void

+ 4 - 7
tests/TestCase/Console/Command/Task/ControllerTaskTest.php

@@ -66,7 +66,6 @@ class ControllerTaskTest extends TestCase {
 		);
 		$this->Task->name = 'Controller';
 		$this->Task->connection = 'test';
-		$this->Task->path = '/my/path/';
 
 		$this->Task->Template = new TemplateTask($out, $out, $in);
 		$this->Task->Template->params['theme'] = 'default';
@@ -165,7 +164,7 @@ class ControllerTaskTest extends TestCase {
 		$this->Task->params['helpers'] = 'Html,Time';
 		$this->Task->params['components'] = 'Csrf, Auth';
 
-		$filename = '/my/path/BakeArticlesController.php';
+		$filename = APP . 'Controller/BakeArticlesController.php';
 		$this->Task->expects($this->at(1))
 			->method('createFile')
 			->with(
@@ -189,7 +188,7 @@ class ControllerTaskTest extends TestCase {
 	public function testBakePrefixed() {
 		$this->Task->params['prefix'] = 'Admin';
 
-		$filename = $this->_normalizePath('/my/path/Admin/BakeArticlesController.php');
+		$filename = $this->_normalizePath(APP . 'Controller/Admin/BakeArticlesController.php');
 		$this->Task->expects($this->at(1))
 			->method('createFile')
 			->with($filename, $this->anything());
@@ -300,14 +299,13 @@ class ControllerTaskTest extends TestCase {
 			$this->markTestSkipped('Additional tables detected.');
 		}
 		$this->Task->connection = 'test';
-		$this->Task->path = '/my/path/';
 		$this->Task->args = ['all'];
 		$this->Task->params = ['helpers' => 'Time,Text'];
 
 		$this->Task->Test->expects($this->atLeastOnce())
 			->method('bake');
 
-		$filename = '/my/path/BakeArticlesController.php';
+		$filename = APP . 'Controller/BakeArticlesController.php';
 		$this->Task->expects($this->at(1))
 			->method('createFile')
 			->with($filename, $this->logicalAnd(
@@ -338,10 +336,9 @@ class ControllerTaskTest extends TestCase {
  */
 	public function testExecuteWithControllerNameVariations($name) {
 		$this->Task->connection = 'test';
-		$this->Task->path = '/my/path/';
 		$this->Task->args = [$name];
 
-		$filename = '/my/path/BakeArticlesController.php';
+		$filename = APP . 'Controller/BakeArticlesController.php';
 		$this->Task->expects($this->once())
 			->method('createFile')
 			->with($filename, $this->stringContains('public function index()'));

+ 18 - 25
tests/TestCase/Console/Command/Task/FixtureTaskTest.php

@@ -71,12 +71,17 @@ class FixtureTaskTest extends TestCase {
  *
  * @return void
  */
+<<<<<<< HEAD
 	public function testConstruct() {
 		$out = $this->getMock('Cake\Console\ConsoleOutput', array(), array(), '', false);
 		$in = $this->getMock('Cake\Console\ConsoleInput', array(), array(), '', false);
 
 		$Task = new FixtureTask($out, $out, $in);
 		$this->assertEquals(ROOT . DS . 'Test' . DS . 'Fixture' . DS, $Task->path);
+=======
+	public function testGetPath() {
+		$this->assertEquals(ROOT . '/Test/Fixture/', $this->Task->getPath());
+>>>>>>> Update other bake tasks to use newer style path generation.
 	}
 
 /**
@@ -125,7 +130,6 @@ class FixtureTaskTest extends TestCase {
  */
 	public function testImportRecordsFromDatabaseWithConditionsPoo() {
 		$this->Task->connection = 'test';
-		$this->Task->path = '/my/path/';
 
 		$result = $this->Task->bake('Articles', false, array(
 			'fromTable' => true,
@@ -169,7 +173,6 @@ class FixtureTaskTest extends TestCase {
 		$articles->updateAll(['body' => "Body \"value\""], []);
 
 		$this->Task->connection = 'test';
-		$this->Task->path = '/my/path/';
 		$result = $this->Task->bake('Article', false, array(
 			'fromTable' => true,
 			'schema' => 'Article',
@@ -185,10 +188,9 @@ class FixtureTaskTest extends TestCase {
  */
 	public function testExecuteWithTableOption() {
 		$this->Task->connection = 'test';
-		$this->Task->path = '/my/path/';
 		$this->Task->args = array('article');
 		$this->Task->params = ['table' => 'comments'];
-		$filename = '/my/path/ArticleFixture.php';
+		$filename = ROOT . '/Test/Fixture/ArticleFixture.php';
 
 		$this->Task->expects($this->at(0))
 			->method('createFile')
@@ -205,9 +207,8 @@ class FixtureTaskTest extends TestCase {
  */
 	public function testExecuteWithNamedModel() {
 		$this->Task->connection = 'test';
-		$this->Task->path = '/my/path/';
 		$this->Task->args = array('article');
-		$filename = '/my/path/ArticleFixture.php';
+		$filename = ROOT . '/Test/Fixture/ArticleFixture.php';
 
 		$this->Task->expects($this->at(0))
 			->method('createFile')
@@ -223,18 +224,17 @@ class FixtureTaskTest extends TestCase {
  */
 	public function testExecuteIntoAll() {
 		$this->Task->connection = 'test';
-		$this->Task->path = '/my/path/';
 		$this->Task->args = array('all');
 		$this->Task->Model->expects($this->any())
 			->method('listAll')
 			->will($this->returnValue(array('articles', 'comments')));
 
-		$filename = '/my/path/ArticleFixture.php';
+		$filename = ROOT . '/Test/Fixture/ArticleFixture.php';
 		$this->Task->expects($this->at(0))
 			->method('createFile')
 			->with($filename, $this->stringContains('class ArticleFixture'));
 
-		$filename = '/my/path/CommentFixture.php';
+		$filename = ROOT . '/Test/Fixture/CommentFixture.php';
 		$this->Task->expects($this->at(1))
 			->method('createFile')
 			->with($filename, $this->stringContains('class CommentFixture'));
@@ -249,19 +249,18 @@ class FixtureTaskTest extends TestCase {
  */
 	public function testAllWithCountAndRecordsFlags() {
 		$this->Task->connection = 'test';
-		$this->Task->path = '/my/path/';
 		$this->Task->args = ['all'];
 		$this->Task->params = ['count' => 10, 'records' => true];
 
 		$this->Task->Model->expects($this->any())->method('listAll')
 			->will($this->returnValue(array('Articles', 'comments')));
 
-		$filename = '/my/path/ArticleFixture.php';
+		$filename = ROOT . '/Test/Fixture/ArticleFixture.php';
 		$this->Task->expects($this->at(0))
 			->method('createFile')
 			->with($filename, $this->stringContains("'title' => 'Third Article'"));
 
-		$filename = '/my/path/CommentFixture.php';
+		$filename = ROOT . '/Test/Fixture/CommentFixture.php';
 		$this->Task->expects($this->at(1))
 			->method('createFile')
 			->with($filename, $this->stringContains("'comment' => 'First Comment for First Article'"));
@@ -277,18 +276,17 @@ class FixtureTaskTest extends TestCase {
  */
 	public function testAllWithSchemaImport() {
 		$this->Task->connection = 'test';
-		$this->Task->path = '/my/path/';
 		$this->Task->args = array('all');
 		$this->Task->params = array('schema' => true);
 
 		$this->Task->Model->expects($this->any())->method('listAll')
 			->will($this->returnValue(array('Articles', 'comments')));
 
-		$filename = '/my/path/ArticleFixture.php';
+		$filename = ROOT . '/Test/Fixture/ArticleFixture.php';
 		$this->Task->expects($this->at(0))->method('createFile')
 			->with($filename, $this->stringContains("public \$import = ['model' => 'Articles'"));
 
-		$filename = '/my/path/CommentFixture.php';
+		$filename = ROOT . '/Test/Fixture/CommentFixture.php';
 		$this->Task->expects($this->at(1))->method('createFile')
 			->with($filename, $this->stringContains("public \$import = ['model' => 'Comments'"));
 		$this->Task->expects($this->exactly(2))->method('createFile');
@@ -303,13 +301,12 @@ class FixtureTaskTest extends TestCase {
  */
 	public function testExecuteNoArgs() {
 		$this->Task->connection = 'test';
-		$this->Task->path = '/my/path/';
 
 		$this->Task->Model->expects($this->any())
 			->method('listAll')
 			->will($this->returnValue(['articles', 'comments']));
 
-		$filename = '/my/path/ArticleFixture.php';
+		$filename = ROOT . '/Test/Fixture/ArticleFixture.php';
 		$this->Task->expects($this->never())
 			->method('createFile');
 
@@ -323,7 +320,6 @@ class FixtureTaskTest extends TestCase {
  */
 	public function testBake() {
 		$this->Task->connection = 'test';
-		$this->Task->path = '/my/path/';
 
 		$result = $this->Task->bake('Article');
 		$this->assertContains('class ArticleFixture extends TestFixture', $result);
@@ -357,7 +353,6 @@ class FixtureTaskTest extends TestCase {
  */
 	public function testRecordGenerationForBinaryAndFloat() {
 		$this->Task->connection = 'test';
-		$this->Task->path = '/my/path/';
 
 		$result = $this->Task->bake('Article', 'datatypes');
 		$this->assertContains("'float_field' => 1", $result);
@@ -377,10 +372,10 @@ class FixtureTaskTest extends TestCase {
  */
 	public function testGenerateFixtureFile() {
 		$this->Task->connection = 'test';
-		$this->Task->path = '/my/path/';
-		$filename = '/my/path/ArticleFixture.php';
+		$filename = ROOT . '/Test/Fixture/ArticleFixture.php';
 
-		$this->Task->expects($this->at(0))->method('createFile')
+		$this->Task->expects($this->at(0))
+			->method('createFile')
 			->with($filename, $this->stringContains('ArticleFixture'));
 
 		$result = $this->Task->generateFixtureFile('Article', []);
@@ -395,10 +390,8 @@ class FixtureTaskTest extends TestCase {
  */
 	public function testGeneratePluginFixtureFile() {
 		$this->Task->connection = 'test';
-		$this->Task->path = $this->_normalizePath('/my/path/');
 		$this->Task->plugin = 'TestPlugin';
-		$filename = TEST_APP . 'Plugin/TestPlugin/Test/Fixture/ArticleFixture.php';
-		$filename = str_replace('/', DS, $filename);
+		$filename = $this->_normalizePath(TEST_APP . 'Plugin/TestPlugin/Test/Fixture/ArticleFixture.php');
 
 		Plugin::load('TestPlugin');
 		$this->Task->expects($this->at(0))->method('createFile')

+ 19 - 23
tests/TestCase/Console/Command/Task/ModelTaskTest.php

@@ -747,15 +747,14 @@ class ModelTaskTest extends TestCase {
  */
 	public function testExecuteWithNamedModel() {
 		$this->Task->connection = 'test';
-		$this->Task->path = $this->_normalizePath('/my/path/');
 		$this->Task->args = ['BakeArticles'];
 
-		$tableFile = $this->_normalizePath('/my/path/Table/BakeArticlesTable.php');
+		$tableFile = $this->_normalizePath(APP . 'Model/Table/BakeArticlesTable.php');
 		$this->Task->expects($this->at(0))
 			->method('createFile')
 			->with($tableFile, $this->stringContains('class BakeArticlesTable extends Table'));
 
-		$entityFile = $this->_normalizePath('/my/path/Entity/BakeArticle.php');
+		$entityFile = $this->_normalizePath(APP 'Model/Entity/BakeArticle.php');
 		$this->Task->expects($this->at(1))
 			->method('createFile')
 			->with($entityFile, $this->stringContains('class BakeArticle extends Entity'));
@@ -782,10 +781,9 @@ class ModelTaskTest extends TestCase {
  */
 	public function testExecuteWithNamedModelVariations($name) {
 		$this->Task->connection = 'test';
-		$this->Task->path = $this->_normalizePath('/my/path/');
 
 		$this->Task->args = array($name);
-		$filename = $this->_normalizePath('/my/path/Table/BakeArticlesTable.php');
+		$filename = $this->_normalizePath(APP . 'Model/Table/BakeArticlesTable.php');
 
 		$this->Task->expects($this->at(0))
 			->method('createFile')
@@ -805,7 +803,6 @@ class ModelTaskTest extends TestCase {
 		}
 
 		$this->Task->connection = 'test';
-		$this->Task->path = $this->_normalizePath('/my/path/');
 		$this->Task->args = ['all'];
 
 		$this->Task->Fixture->expects($this->exactly($count))
@@ -813,52 +810,52 @@ class ModelTaskTest extends TestCase {
 		$this->Task->Test->expects($this->exactly($count))
 			->method('bake');
 
-		$filename = $this->_normalizePath('/my/path/Table/BakeArticlesTable.php');
+		$filename = $this->_normalizePath(APP . 'Model/Table/BakeArticlesTable.php');
 		$this->Task->expects($this->at(0))
 			->method('createFile')
 			->with($filename, $this->stringContains('class BakeArticlesTable extends'));
 
-		$filename = $this->_normalizePath('/my/path/Entity/BakeArticle.php');
+		$filename = $this->_normalizePath(APP . 'Model/Entity/BakeArticle.php');
 		$this->Task->expects($this->at(1))
 			->method('createFile')
 			->with($filename, $this->stringContains('class BakeArticle extends'));
 
-		$filename = $this->_normalizePath('/my/path/Table/BakeArticlesBakeTagsTable.php');
+		$filename = $this->_normalizePath(APP . 'Model/Table/BakeArticlesBakeTagsTable.php');
 		$this->Task->expects($this->at(2))
 			->method('createFile')
 			->with($filename, $this->stringContains('class BakeArticlesBakeTagsTable extends'));
 
-		$filename = $this->_normalizePath('/my/path/Entity/BakeArticlesBakeTag.php');
+		$filename = $this->_normalizePath(APP . 'Model/Entity/BakeArticlesBakeTag.php');
 		$this->Task->expects($this->at(3))
 			->method('createFile')
 			->with($filename, $this->stringContains('class BakeArticlesBakeTag extends'));
 
-		$filename = $this->_normalizePath('/my/path/Table/BakeCommentsTable.php');
+		$filename = $this->_normalizePath(APP . 'Model/Table/BakeCommentsTable.php');
 		$this->Task->expects($this->at(4))
 			->method('createFile')
 			->with($filename, $this->stringContains('class BakeCommentsTable extends'));
 
-		$filename = $this->_normalizePath('/my/path/Entity/BakeComment.php');
+		$filename = $this->_normalizePath(APP . 'Model/Entity/BakeComment.php');
 		$this->Task->expects($this->at(5))
 			->method('createFile')
 			->with($filename, $this->stringContains('class BakeComment extends'));
 
-		$filename = $this->_normalizePath('/my/path/Table/BakeTagsTable.php');
+		$filename = $this->_normalizePath(APP . 'Model/Table/BakeTagsTable.php');
 		$this->Task->expects($this->at(6))
 			->method('createFile')
 			->with($filename, $this->stringContains('class BakeTagsTable extends'));
 
-		$filename = $this->_normalizePath('/my/path/Entity/BakeTag.php');
+		$filename = $this->_normalizePath(APP . 'Model/Entity/BakeTag.php');
 		$this->Task->expects($this->at(7))
 			->method('createFile')
 			->with($filename, $this->stringContains('class BakeTag extends'));
 
-		$filename = $this->_normalizePath('/my/path/Table/CategoryThreadsTable.php');
+		$filename = $this->_normalizePath(APP . 'Model/Table/CategoryThreadsTable.php');
 		$this->Task->expects($this->at(8))
 			->method('createFile')
 			->with($filename, $this->stringContains('class CategoryThreadsTable extends'));
 
-		$filename = $this->_normalizePath('/my/path/Entity/CategoryThread.php');
+		$filename = $this->_normalizePath(APP . 'Model/Entity/CategoryThread.php');
 		$this->Task->expects($this->at(9))
 			->method('createFile')
 			->with($filename, $this->stringContains('class CategoryThread extends'));
@@ -878,7 +875,6 @@ class ModelTaskTest extends TestCase {
 		}
 
 		$this->Task->connection = 'test';
-		$this->Task->path = $this->_normalizePath('/my/path/');
 		$this->Task->args = ['all'];
 		$this->Task->skipTables = ['bake_tags'];
 
@@ -887,32 +883,32 @@ class ModelTaskTest extends TestCase {
 		$this->Task->Test->expects($this->exactly(7))
 			->method('bake');
 
-		$filename = $this->_normalizePath('/my/path/Entity/BakeArticle.php');
+		$filename = $this->_normalizePath(APP . 'Model/Entity/BakeArticle.php');
 		$this->Task->expects($this->at(1))
 			->method('createFile')
 			->with($filename);
 
-		$filename = $this->_normalizePath('/my/path/Entity/BakeArticlesBakeTag.php');
+		$filename = $this->_normalizePath(APP . 'Model/Entity/BakeArticlesBakeTag.php');
 		$this->Task->expects($this->at(3))
 			->method('createFile')
 			->with($filename);
 
-		$filename = $this->_normalizePath('/my/path/Entity/BakeComment.php');
+		$filename = $this->_normalizePath(APP . 'Model/Entity/BakeComment.php');
 		$this->Task->expects($this->at(5))
 			->method('createFile')
 			->with($filename);
 
-		$filename = $this->_normalizePath('/my/path/Entity/CategoryThread.php');
+		$filename = $this->_normalizePath(APP . 'Model/Entity/CategoryThread.php');
 		$this->Task->expects($this->at(7))
 			->method('createFile')
 			->with($filename);
 
-		$filename = $this->_normalizePath('/my/path/Entity/CounterCacheUser.php');
+		$filename = $this->_normalizePath(APP . 'Model/Entity/CounterCacheUser.php');
 		$this->Task->expects($this->at(9))
 			->method('createFile')
 			->with($filename);
 
-		$filename = $this->_normalizePath('/my/path/Entity/NumberTree.php');
+		$filename = $this->_normalizePath(APP . 'Model/Entity/NumberTree.php');
 		$this->Task->expects($this->at(11))
 			->method('createFile')
 			->with($filename);

+ 1 - 3
tests/TestCase/Console/Command/Task/TestTaskTest.php

@@ -591,10 +591,8 @@ class TestTaskTest extends TestCase {
  * @return void
  */
 	public function testTestCaseFileName($type, $class, $expected) {
-		$this->Task->path = DS . 'my/path/tests/';
-
 		$result = $this->Task->testCaseFileName($type, $class);
-		$expected = $this->Task->path . $expected;
+		$expected = ROOT . DS . 'Test/' . $expected;
 		$this->assertPathEquals($expected, $result);
 	}
 

+ 11 - 14
tests/TestCase/Console/Command/Task/ViewTaskTest.php

@@ -123,7 +123,6 @@ class ViewTaskTest extends TestCase {
 		$this->Task->Template = new TemplateTask($out, $out, $in);
 		$this->Task->Model = $this->getMock('Cake\Console\Command\Task\ModelTask', [], [$out, $out, $in]);
 
-		$this->Task->path = TMP;
 		$this->Task->Template->params['theme'] = 'default';
 		$this->Task->Template->templatePaths = ['default' => CAKE . 'Console/Templates/default/'];
 	}
@@ -228,14 +227,13 @@ class ViewTaskTest extends TestCase {
  */
 	public function testGetPath() {
 		$this->Task->controllerName = 'Posts';
-		$this->Task->path = '/path/Template/';
 
 		$result = $this->Task->getPath();
-		$this->assertPathEquals('/path/Template/Posts/', $result);
+		$this->assertPathEquals(APP . 'Template/Posts/', $result);
 
 		$this->Task->params['prefix'] = 'admin';
 		$result = $this->Task->getPath();
-		$this->assertPathEquals('/path/Template/Admin/Posts/', $result);
+		$this->assertPathEquals(APP . 'Template/Admin/Posts/', $result);
 	}
 
 /**
@@ -245,7 +243,6 @@ class ViewTaskTest extends TestCase {
  */
 	public function testGetPathPlugin() {
 		$this->Task->controllerName = 'Posts';
-		$this->Task->path = '/path/Template/';
 
 		$pluginPath = APP . 'Plugin/TestPlugin/';
 		Plugin::load('TestPlugin', array('path' => $pluginPath));
@@ -342,7 +339,7 @@ class ViewTaskTest extends TestCase {
 		$this->Task->expects($this->at(0))
 			->method('createFile')
 			->with(
-				TMP . 'ViewTaskComments' . DS . 'view.ctp',
+				$this->_normalizePath(APP . 'Template/ViewTaskComments/view.ctp'),
 				$this->stringContains('View Task Comments')
 			);
 
@@ -361,7 +358,7 @@ class ViewTaskTest extends TestCase {
 
 		$this->Task->expects($this->at(0))->method('createFile')
 			->with(
-				TMP . 'ViewTaskComments' . DS . 'edit.ctp',
+				$this->_normalizePath(APP . 'Template/ViewTaskComments/edit.ctp'),
 				$this->anything()
 			);
 		$result = $this->Task->bake('edit', true);
@@ -382,7 +379,7 @@ class ViewTaskTest extends TestCase {
 
 		$this->Task->expects($this->at(0))->method('createFile')
 			->with(
-				TMP . 'ViewTaskComments' . DS . 'index.ctp',
+				$this->_normalizePath(APP . 'Template/ViewTaskComments/index.ctp'),
 				$this->stringContains("\$viewTaskComment->article->title")
 			);
 		$this->Task->bake('index', true);
@@ -415,17 +412,17 @@ class ViewTaskTest extends TestCase {
 		$this->Task->expects($this->at(0))
 			->method('createFile')
 			->with(
-				TMP . 'ViewTaskComments' . DS . 'view.ctp',
+				$this->_normalizePath(APP . 'Template/ViewTaskComments/view.ctp'),
 				$this->stringContains('View Task Comments')
 			);
 		$this->Task->expects($this->at(1))->method('createFile')
 			->with(
-				TMP . 'ViewTaskComments' . DS . 'edit.ctp',
+				$this->_normalizePath(APP . 'Template/ViewTaskComments/edit.ctp'),
 				$this->stringContains('Edit View Task Comment')
 			);
 		$this->Task->expects($this->at(2))->method('createFile')
 			->with(
-				TMP . 'ViewTaskComments' . DS . 'index.ctp',
+				$this->_normalizePath(APP . 'Template/ViewTaskComments/index.ctp'),
 				$this->stringContains('ViewTaskComment')
 			);
 
@@ -447,7 +444,7 @@ class ViewTaskTest extends TestCase {
 
 		$this->Task->expects($this->once())->method('createFile')
 			->with(
-				TMP . 'ViewTaskComments' . DS . 'my_action.ctp',
+				$this->_normalizePath(APP . 'Template/ViewTaskComments/my_action.ctp'),
 				$this->anything()
 			);
 
@@ -580,7 +577,7 @@ class ViewTaskTest extends TestCase {
 		foreach ($views as $i => $view) {
 			$this->Task->expects($this->at($i))->method('createFile')
 				->with(
-					TMP . 'Blog' . DS . $view,
+					$this->_normalizePath(APP . 'Template/Blog/' . $view),
 					$this->anything()
 				);
 		}
@@ -603,7 +600,7 @@ class ViewTaskTest extends TestCase {
 		foreach ($views as $i => $view) {
 			$this->Task->expects($this->at($i))->method('createFile')
 				->with(
-					TMP . 'Admin' . DS . 'Posts' . DS . $view,
+					$this->_normalizePath(APP . 'Template/Admin/Posts/' . $view),
 					$this->anything()
 				);
 		}