Fix most coding standards issues in Test/Console

This commit is contained in:
mark_story 2012-03-10 23:32:02 -05:00
parent fdcb3dc34f
commit ed1d34accc
15 changed files with 54 additions and 50 deletions

View file

@ -28,7 +28,9 @@ App::uses('Controller', 'Controller');
if (!class_exists('UsersController')) { if (!class_exists('UsersController')) {
class UsersController extends Controller { class UsersController extends Controller {
public $name = 'Users'; public $name = 'Users';
} }
} }
@ -89,7 +91,7 @@ class BakeShellTest extends CakeTestCase {
$this->Shell->Model->expects($this->never()) $this->Shell->Model->expects($this->never())
->method('getName'); ->method('getName');
$this->Shell->Model->expects($this->once()) $this->Shell->Model->expects($this->once())
->method('bake') ->method('bake')
->will($this->returnValue(true)); ->will($this->returnValue(true));
@ -97,7 +99,7 @@ class BakeShellTest extends CakeTestCase {
$this->Shell->Controller->expects($this->once()) $this->Shell->Controller->expects($this->once())
->method('bake') ->method('bake')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$this->Shell->View->expects($this->once()) $this->Shell->View->expects($this->once())
->method('execute'); ->method('execute');

View file

@ -24,14 +24,17 @@ App::uses('Shell', 'Console');
class TestStringOutput extends ConsoleOutput { class TestStringOutput extends ConsoleOutput {
public $output = ''; public $output = '';
protected function _write($message) { protected function _write($message) {
$this->output .= $message; $this->output .= $message;
} }
} }
class CommandListShellTest extends CakeTestCase { class CommandListShellTest extends CakeTestCase {
/** /**
* setUp method * setUp method
* *
@ -85,7 +88,6 @@ class CommandListShellTest extends CakeTestCase {
$expected = "/welcome \[.*TestPluginTwo.*\]/"; $expected = "/welcome \[.*TestPluginTwo.*\]/";
$this->assertRegExp($expected, $output); $this->assertRegExp($expected, $output);
$expected = "/acl \[.*CORE.*\]/"; $expected = "/acl \[.*CORE.*\]/";
$this->assertRegExp($expected, $output); $this->assertRegExp($expected, $output);

View file

@ -38,9 +38,13 @@ if (!$imported) {
define('ARTICLE_MODEL_CREATED', true); define('ARTICLE_MODEL_CREATED', true);
class BakeArticle extends Model { class BakeArticle extends Model {
public $name = 'BakeArticle'; public $name = 'BakeArticle';
public $hasMany = array('BakeComment'); public $hasMany = array('BakeComment');
public $hasAndBelongsToMany = array('BakeTag'); public $hasAndBelongsToMany = array('BakeTag');
} }
} }
@ -303,7 +307,7 @@ class ControllerTaskTest extends CakeTestCase {
$this->Task->plugin = 'ControllerTest'; $this->Task->plugin = 'ControllerTest';
//fake plugin path //fake plugin path
CakePlugin::load('ControllerTest', array('path' => APP . 'Plugin' . DS . 'ControllerTest' . DS)); CakePlugin::load('ControllerTest', array('path' => APP . 'Plugin' . DS . 'ControllerTest' . DS));
$path = APP . 'Plugin' . DS . 'ControllerTest' . DS . 'Controller' . DS . 'ArticlesController.php'; $path = APP . 'Plugin' . DS . 'ControllerTest' . DS . 'Controller' . DS . 'ArticlesController.php';
$this->Task->expects($this->at(1))->method('createFile')->with( $this->Task->expects($this->at(1))->method('createFile')->with(
@ -551,7 +555,7 @@ class ControllerTaskTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
static function nameVariations() { public static function nameVariations() {
return array( return array(
array('BakeArticles'), array('BakeArticle'), array('bake_article'), array('bake_articles') array('BakeArticles'), array('BakeArticle'), array('bake_article'), array('bake_articles')
); );

View file

@ -110,7 +110,7 @@ class ExtractTaskTest extends CakeTestCase {
$pattern = '/msgid "Your database configuration file is NOT present."\nmsgstr ""\n/'; $pattern = '/msgid "Your database configuration file is NOT present."\nmsgstr ""\n/';
$this->assertRegExp($pattern, $result); $this->assertRegExp($pattern, $result);
$pattern = '/msgid "Rename config\/database.php.default to '; $pattern = '/msgid "Rename config\/database.php.default to ';
$pattern .= 'config\/database.php"\nmsgstr ""\n/'; $pattern .= 'config\/database.php"\nmsgstr ""\n/';
$this->assertRegExp($pattern, $result); $this->assertRegExp($pattern, $result);
@ -358,7 +358,6 @@ class ExtractTaskTest extends CakeTestCase {
$this->assertRegExp($pattern, $result); $this->assertRegExp($pattern, $result);
} }
/** /**
* Test that the extract shell can obtain validation messages from models inside a specific plugin * Test that the extract shell can obtain validation messages from models inside a specific plugin
* *
@ -382,10 +381,10 @@ class ExtractTaskTest extends CakeTestCase {
$this->Task->execute(); $this->Task->execute();
$result = file_get_contents($this->path . DS . 'test_plugin.pot'); $result = file_get_contents($this->path . DS . 'test_plugin.pot');
$pattern = preg_quote('#Model' . DS . 'TestPluginPost.php:validation for field title#', '\\'); $pattern = preg_quote('#Model' . DS . 'TestPluginPost.php:validation for field title#', '\\');
$this->assertRegExp($pattern, $result); $this->assertRegExp($pattern, $result);
$pattern = preg_quote('#Model' . DS . 'TestPluginPost.php:validation for field body#', '\\'); $pattern = preg_quote('#Model' . DS . 'TestPluginPost.php:validation for field body#', '\\');
$this->assertRegExp($pattern, $result); $this->assertRegExp($pattern, $result);
$pattern = '#msgid "Post title is required"#'; $pattern = '#msgid "Post title is required"#';

View file

@ -377,7 +377,7 @@ class FixtureTaskTest extends CakeTestCase {
$filename = APP . 'Plugin' . DS . 'TestFixture' . DS . 'Test' . DS . 'Fixture' . DS . 'ArticleFixture.php'; $filename = APP . 'Plugin' . DS . 'TestFixture' . DS . 'Test' . DS . 'Fixture' . DS . 'ArticleFixture.php';
//fake plugin path //fake plugin path
CakePlugin::load('TestFixture', array('path' => APP . 'Plugin' . DS . 'TestFixture' . DS)); CakePlugin::load('TestFixture', array('path' => APP . 'Plugin' . DS . 'TestFixture' . DS));
$this->Task->expects($this->at(0))->method('createFile') $this->Task->expects($this->at(0))->method('createFile')
->with($filename, $this->stringContains('class Article')); ->with($filename, $this->stringContains('class Article'));

View file

@ -823,7 +823,7 @@ STRINGEND;
$this->Task->plugin = 'ControllerTest'; $this->Task->plugin = 'ControllerTest';
//fake plugin path //fake plugin path
CakePlugin::load('ControllerTest', array('path' => APP . 'Plugin' . DS . 'ControllerTest' . DS)); CakePlugin::load('ControllerTest', array('path' => APP . 'Plugin' . DS . 'ControllerTest' . DS));
$path = APP . 'Plugin' . DS . 'ControllerTest' . DS . 'Model' . DS . 'BakeArticle.php'; $path = APP . 'Plugin' . DS . 'ControllerTest' . DS . 'Model' . DS . 'BakeArticle.php';
$this->Task->expects($this->once())->method('createFile') $this->Task->expects($this->once())->method('createFile')
->with($path, $this->stringContains('BakeArticle extends ControllerTestAppModel')); ->with($path, $this->stringContains('BakeArticle extends ControllerTestAppModel'));
@ -861,7 +861,7 @@ STRINGEND;
* *
* @return void * @return void
*/ */
static function nameVariations() { public static function nameVariations() {
return array( return array(
array('BakeArticles'), array('BakeArticle'), array('bake_article'), array('bake_articles') array('BakeArticles'), array('BakeArticle'), array('bake_article'), array('bake_articles')
); );

View file

@ -72,7 +72,7 @@ class PluginTaskTest extends CakeTestCase {
$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());

View file

@ -93,11 +93,11 @@ class ProjectTaskTest extends CakeTestCase {
'Console' . DS . 'Templates', 'Console' . DS . 'Templates',
'Console' . DS . 'Command' . DS . 'Task', 'Console' . DS . 'Command' . DS . 'Task',
'Controller', 'Controller',
'Controller' . DS. 'Component', 'Controller' . DS . 'Component',
'Locale', 'Locale',
'Model', 'Model',
'Model' . DS. 'Behavior', 'Model' . DS . 'Behavior',
'Model' . DS. 'Datasource', 'Model' . DS . 'Datasource',
'Plugin', 'Plugin',
'Test', 'Test',
'Test' . DS . 'Case', 'Test' . DS . 'Case',
@ -141,10 +141,10 @@ class ProjectTaskTest extends CakeTestCase {
$this->Task->execute(); $this->Task->execute();
$this->assertTrue(is_dir($this->Task->args[0]), 'No project dir'); $this->assertTrue(is_dir($this->Task->args[0]), 'No project dir');
$File = new File($path . DS . 'webroot' . DS . 'index.php'); $File = new File($path . DS . 'webroot' . DS . 'index.php');
$contents = $File->read(); $contents = $File->read();
$this->assertRegExp('/define\(\'CAKE_CORE_INCLUDE_PATH\', .*?DS/', $contents); $this->assertRegExp('/define\(\'CAKE_CORE_INCLUDE_PATH\', .*?DS/', $contents);
$File = new File($path . DS . 'webroot' . DS . 'test.php'); $File = new File($path . DS . 'webroot' . DS . 'test.php');
$contents = $File->read(); $contents = $File->read();
$this->assertRegExp('/define\(\'CAKE_CORE_INCLUDE_PATH\', .*?DS/', $contents); $this->assertRegExp('/define\(\'CAKE_CORE_INCLUDE_PATH\', .*?DS/', $contents);
} }
@ -167,10 +167,10 @@ class ProjectTaskTest extends CakeTestCase {
$this->Task->execute(); $this->Task->execute();
$this->assertTrue(is_dir($this->Task->args[0]), 'No project dir'); $this->assertTrue(is_dir($this->Task->args[0]), 'No project dir');
$contents = file_get_contents($path . DS . 'webroot' . DS . 'index.php'); $contents = file_get_contents($path . DS . 'webroot' . DS . 'index.php');
$this->assertRegExp('#//define\(\'CAKE_CORE_INCLUDE_PATH#', $contents); $this->assertRegExp('#//define\(\'CAKE_CORE_INCLUDE_PATH#', $contents);
$contents = file_get_contents($path . DS . 'webroot' . DS . 'test.php'); $contents = file_get_contents($path . DS . 'webroot' . DS . 'test.php');
$this->assertRegExp('#//define\(\'CAKE_CORE_INCLUDE_PATH#', $contents); $this->assertRegExp('#//define\(\'CAKE_CORE_INCLUDE_PATH#', $contents);
ini_set('include_path', $restore); ini_set('include_path', $restore);
@ -341,7 +341,7 @@ class ProjectTaskTest extends CakeTestCase {
$this->Task->execute(); $this->Task->execute();
$this->assertTrue(is_dir($path), 'No project dir'); $this->assertTrue(is_dir($path), 'No project dir');
$this->assertTrue(is_dir($path . DS . 'Controller'), 'No controllers dir '); $this->assertTrue(is_dir($path . DS . 'Controller'), 'No controllers dir ');
$this->assertTrue(is_dir($path . DS . 'Controller' . DS .'Component'), 'No components dir '); $this->assertTrue(is_dir($path . DS . 'Controller' . DS . 'Component'), 'No components dir ');
$this->assertTrue(is_dir($path . DS . 'Model'), 'No models dir'); $this->assertTrue(is_dir($path . DS . 'Model'), 'No models dir');
$this->assertTrue(is_dir($path . DS . 'View'), 'No views dir'); $this->assertTrue(is_dir($path . DS . 'View'), 'No views dir');
$this->assertTrue(is_dir($path . DS . 'View' . DS . 'Helper'), 'No helpers dir'); $this->assertTrue(is_dir($path . DS . 'View' . DS . 'Helper'), 'No helpers dir');

View file

@ -99,7 +99,7 @@ class TemplateTaskTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testGetThemePath() { public function testGetThemePath() {
$defaultTheme = CAKE . 'Console' . DS . 'Templates' . DS . 'default' .DS; $defaultTheme = CAKE . 'Console' . DS . 'Templates' . DS . 'default' . DS;
$this->Task->templatePaths = array('default' => $defaultTheme); $this->Task->templatePaths = array('default' => $defaultTheme);
$this->Task->expects($this->exactly(1))->method('in')->will($this->returnValue('1')); $this->Task->expects($this->exactly(1))->method('in')->will($this->returnValue('1'));
@ -126,7 +126,7 @@ class TemplateTaskTest extends CakeTestCase {
public function testGenerate() { public function testGenerate() {
App::build(array( App::build(array(
'Console' => array( 'Console' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'Console' . DS CAKE . 'Test' . DS . 'test_app' . DS . 'Console' . DS
) )
)); ));
$this->Task->initialize(); $this->Task->initialize();
@ -146,7 +146,7 @@ class TemplateTaskTest extends CakeTestCase {
public function testGenerateWithTemplateFallbacks() { public function testGenerateWithTemplateFallbacks() {
App::build(array( App::build(array(
'Console' => array( 'Console' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'Console' . DS, CAKE . 'Test' . DS . 'test_app' . DS . 'Console' . DS,
CAKE_CORE_INCLUDE_PATH . DS . 'console' . DS CAKE_CORE_INCLUDE_PATH . DS . 'console' . DS
) )
)); ));

View file

@ -99,6 +99,7 @@ class TestTaskArticle extends Model {
*/ */
protected function _innerMethod() { protected function _innerMethod() {
} }
} }
/** /**
@ -403,7 +404,7 @@ class TestTaskTest extends CakeTestCase {
$result = $this->Task->getRealClassname('Controller', 'PostsController'); $result = $this->Task->getRealClassname('Controller', 'PostsController');
$this->assertEquals('PostsController', $result); $this->assertEquals('PostsController', $result);
$result = $this->Task->getRealClassname('Controller', 'AlertTypes'); $result = $this->Task->getRealClassname('Controller', 'AlertTypes');
$this->assertEquals('AlertTypesController', $result); $this->assertEquals('AlertTypesController', $result);
@ -538,7 +539,6 @@ class TestTaskTest extends CakeTestCase {
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
} }
/** /**
* Test that mock class generation works for the appropriate classes * Test that mock class generation works for the appropriate classes
* *
@ -558,8 +558,8 @@ class TestTaskTest extends CakeTestCase {
$this->Task->plugin = 'TestTest'; $this->Task->plugin = 'TestTest';
//fake plugin path //fake plugin path
CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS)); CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS));
$path = APP . 'Plugin' . DS . 'TestTest' . DS . 'Test' . DS . 'Case' . DS . 'View' . DS . 'Helper' . DS .'FormHelperTest.php'; $path = APP . 'Plugin' . DS . 'TestTest' . DS . 'Test' . DS . 'Case' . DS . 'View' . DS . 'Helper' . DS . 'FormHelperTest.php';
$this->Task->expects($this->once())->method('createFile') $this->Task->expects($this->once())->method('createFile')
->with($path, $this->anything()); ->with($path, $this->anything());
@ -636,10 +636,10 @@ class TestTaskTest extends CakeTestCase {
public function testTestCaseFileNamePlugin() { public function testTestCaseFileNamePlugin() {
$this->Task->path = DS . 'my' . DS . 'path' . DS . 'tests' . DS; $this->Task->path = DS . 'my' . DS . 'path' . DS . 'tests' . DS;
CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS )); CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS ));
$this->Task->plugin = 'TestTest'; $this->Task->plugin = 'TestTest';
$result = $this->Task->testCaseFileName('Model', 'Post'); $result = $this->Task->testCaseFileName('Model', 'Post');
$expected = APP . 'Plugin' . DS . 'TestTest' . DS . 'Test' . DS . 'Case' . DS . 'Model' . DS . 'PostTest.php'; $expected = APP . 'Plugin' . DS . 'TestTest' . DS . 'Test' . DS . 'Case' . DS . 'Model' . DS . 'PostTest.php';
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
} }

View file

@ -119,6 +119,7 @@ class ViewTaskCommentsController extends Controller {
*/ */
public function add() { public function add() {
} }
} }
/** /**
@ -191,6 +192,7 @@ class ViewTaskArticlesController extends Controller {
*/ */
public function admin_delete() { public function admin_delete() {
} }
} }
/** /**
@ -230,7 +232,7 @@ class ViewTaskTest extends CakeTestCase {
$this->Task->path = TMP; $this->Task->path = TMP;
$this->Task->Template->params['theme'] = 'default'; $this->Task->Template->params['theme'] = 'default';
$this->Task->Template->templatePaths = array('default' => CAKE . 'Console' . DS . 'Templates' . DS . 'default' .DS); $this->Task->Template->templatePaths = array('default' => CAKE . 'Console' . DS . 'Templates' . DS . 'default' . DS);
} }
/** /**
@ -384,8 +386,8 @@ class ViewTaskTest extends CakeTestCase {
$this->Task->name = 'View'; $this->Task->name = 'View';
//fake plugin path //fake plugin path
CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS)); CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS));
$path = APP . 'Plugin' . DS . 'TestTest' . DS . 'View' . DS . 'ViewTaskComments' . DS . 'view.ctp'; $path = APP . 'Plugin' . DS . 'TestTest' . DS . 'View' . DS . 'ViewTaskComments' . DS . 'view.ctp';
$result = $this->Task->getContent('index'); $result = $this->Task->getContent('index');
$this->assertNotContains('List Test Test.view Task Articles', $result); $this->assertNotContains('List Test Test.view Task Articles', $result);
@ -607,7 +609,6 @@ class ViewTaskTest extends CakeTestCase {
$this->Task->expects($this->any())->method('in') $this->Task->expects($this->any())->method('in')
->will($this->onConsecutiveCalls('y', 'y', 'n')); ->will($this->onConsecutiveCalls('y', 'y', 'n'));
$this->Task->expects($this->at(3))->method('createFile') $this->Task->expects($this->at(3))->method('createFile')
->with( ->with(
TMP . 'ViewTaskComments' . DS . 'index.ctp', TMP . 'ViewTaskComments' . DS . 'index.ctp',
@ -719,7 +720,7 @@ class ViewTaskTest extends CakeTestCase {
$this->assertEquals($result, 'form'); $this->assertEquals($result, 'form');
$this->Task->Template->templatePaths = array( $this->Task->Template->templatePaths = array(
'test' => CAKE . 'Test' . DS . 'test_app' . DS . 'Console' . DS . 'Templates' . DS . 'test' .DS 'test' => CAKE . 'Test' . DS . 'test_app' . DS . 'Console' . DS . 'Templates' . DS . 'test' . DS
); );
$this->Task->Template->params['theme'] = 'test'; $this->Task->Template->params['theme'] = 'test';

View file

@ -29,11 +29,11 @@ class TestTestShell extends TestShell {
public function mapFileToCategory($file) { public function mapFileToCategory($file) {
return $this->_mapFileToCategory($file); return $this->_mapFileToCategory($file);
} }
} }
class TestShellTest extends CakeTestCase { class TestShellTest extends CakeTestCase {
/** /**
* setUp test case * setUp test case
* *
@ -111,7 +111,6 @@ class TestShellTest extends CakeTestCase {
$return = $this->Shell->mapFileToCategory(APP . 'My/File/Is/Here.php'); $return = $this->Shell->mapFileToCategory(APP . 'My/File/Is/Here.php');
$this->assertSame('app', $return); $this->assertSame('app', $return);
} }
/** /**
@ -142,7 +141,6 @@ class TestShellTest extends CakeTestCase {
$return = $this->Shell->mapFileToCategory(dirname(CAKE) . 'plugins/awesome/Controller/ExampleController.php'); $return = $this->Shell->mapFileToCategory(dirname(CAKE) . 'plugins/awesome/Controller/ExampleController.php');
$this->assertSame('awesome', $return); $this->assertSame('awesome', $return);
} }
/** /**
@ -211,7 +209,6 @@ class TestShellTest extends CakeTestCase {
$return = $this->Shell->mapFileToCategory(APP . 'Test/Case/My/File/Is/HereTest.php'); $return = $this->Shell->mapFileToCategory(APP . 'Test/Case/My/File/Is/HereTest.php');
$this->assertSame('app', $return); $this->assertSame('app', $return);
} }
/** /**
@ -242,7 +239,6 @@ class TestShellTest extends CakeTestCase {
$return = $this->Shell->mapFileToCategory(dirname(CAKE) . 'plugins/awesome/Test/Case/Controller/ExampleControllerTest.php'); $return = $this->Shell->mapFileToCategory(dirname(CAKE) . 'plugins/awesome/Test/Case/Controller/ExampleControllerTest.php');
$this->assertSame('awesome', $return); $this->assertSame('awesome', $return);
} }
/** /**

View file

@ -61,7 +61,6 @@ class TestShellDispatcher extends ShellDispatcher {
* @return void * @return void
*/ */
public function clear() { public function clear() {
} }
/** /**
@ -96,6 +95,7 @@ class TestShellDispatcher extends ShellDispatcher {
} }
return parent::_getShell($shell); return parent::_getShell($shell);
} }
} }
/** /**

View file

@ -55,20 +55,18 @@ class ShellTestShell extends Shell {
} }
public function do_something() { public function do_something() {
} }
protected function _secret() { protected function _secret() {
} }
protected function no_access() { protected function no_access() {
} }
public function mergeVars($properties, $class, $normalize = true) { public function mergeVars($properties, $class, $normalize = true) {
return $this->_mergeVars($properties, $class, $normalize); return $this->_mergeVars($properties, $class, $normalize);
} }
} }
/** /**
@ -77,8 +75,11 @@ class ShellTestShell extends Shell {
* @package Cake.Test.Case.Console.Command * @package Cake.Test.Case.Console.Command
*/ */
class TestMergeShell extends Shell { class TestMergeShell extends Shell {
public $tasks = array('DbConfig', 'Fixture'); public $tasks = array('DbConfig', 'Fixture');
public $uses = array('Comment'); public $uses = array('Comment');
} }
/** /**
@ -467,7 +468,7 @@ class ShellTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
public function test__getArgAndParamReferences() { public function testMagicGetArgAndParamReferences() {
$this->Shell->tasks = array('TestApple'); $this->Shell->tasks = array('TestApple');
$this->Shell->args = array('one'); $this->Shell->args = array('one');
$this->Shell->params = array('help' => false); $this->Shell->params = array('help' => false);
@ -489,7 +490,7 @@ class ShellTest extends CakeTestCase {
$path = $expected = DS . 'tmp' . DS . 'ab' . DS . 'cd'; $path = $expected = DS . 'tmp' . DS . 'ab' . DS . 'cd';
$this->assertEquals($this->Shell->shortPath($path), $expected); $this->assertEquals($this->Shell->shortPath($path), $expected);
$path = $expected = DS . 'tmp' . DS . 'ab' . DS . 'cd' . DS ; $path = $expected = DS . 'tmp' . DS . 'ab' . DS . 'cd' . DS;
$this->assertEquals($this->Shell->shortPath($path), $expected); $this->assertEquals($this->Shell->shortPath($path), $expected);
$path = $expected = DS . 'tmp' . DS . 'ab' . DS . 'index.php'; $path = $expected = DS . 'tmp' . DS . 'ab' . DS . 'index.php';
@ -566,7 +567,6 @@ class ShellTest extends CakeTestCase {
->method('read') ->method('read')
->will($this->returnValue('y')); ->will($this->returnValue('y'));
$contents = "<?php\necho 'yet another test';\n\$te = 'st';\n"; $contents = "<?php\necho 'yet another test';\n\$te = 'st';\n";
$result = $this->Shell->createFile($file, $contents); $result = $this->Shell->createFile($file, $contents);
$this->assertTrue($result); $this->assertTrue($result);
@ -659,7 +659,6 @@ class ShellTest extends CakeTestCase {
->method('read') ->method('read')
->will($this->returnValue('y')); ->will($this->returnValue('y'));
$contents = "<?php\r\necho 'yet another test';\r\n\$te = 'st';\r\n"; $contents = "<?php\r\necho 'yet another test';\r\n\$te = 'st';\r\n";
$result = $this->Shell->createFile($file, $contents); $result = $this->Shell->createFile($file, $contents);
$this->assertTrue($result); $this->assertTrue($result);
@ -774,7 +773,6 @@ class ShellTest extends CakeTestCase {
->will($this->returnValue($Parser)); ->will($this->returnValue($Parser));
$Mock->expects($this->once())->method('out'); $Mock->expects($this->once())->method('out');
$result = $Mock->runCommand('idontexist', array()); $result = $Mock->runCommand('idontexist', array());
$this->assertFalse($result); $this->assertFalse($result);
} }
@ -866,7 +864,8 @@ TEXT;
$this->Shell->name = 'test'; $this->Shell->name = 'test';
$this->Shell->plugin = 'plugin'; $this->Shell->plugin = 'plugin';
$parser = $this->Shell->getOptionParser(); $parser = $this->Shell->getOptionParser();
$this->assertEquals('plugin.test', $parser->command()); $this->assertEquals('plugin.test', $parser->command());
} }
} }

View file

@ -21,6 +21,7 @@ App::uses('TaskCollection', 'Console');
App::uses('Shell', 'Console'); App::uses('Shell', 'Console');
class TaskCollectionTest extends CakeTestCase { class TaskCollectionTest extends CakeTestCase {
/** /**
* setUp * setUp
* *