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')) {
class UsersController extends Controller {
public $name = 'Users';
}
}

View file

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

View file

@ -38,9 +38,13 @@ if (!$imported) {
define('ARTICLE_MODEL_CREATED', true);
class BakeArticle extends Model {
public $name = 'BakeArticle';
public $hasMany = array('BakeComment');
public $hasAndBelongsToMany = array('BakeTag');
}
}
@ -551,7 +555,7 @@ class ControllerTaskTest extends CakeTestCase {
*
* @return void
*/
static function nameVariations() {
public static function nameVariations() {
return array(
array('BakeArticles'), array('BakeArticle'), array('bake_article'), array('bake_articles')
);

View file

@ -358,7 +358,6 @@ class ExtractTaskTest extends CakeTestCase {
$this->assertRegExp($pattern, $result);
}
/**
* Test that the extract shell can obtain validation messages from models inside a specific plugin
*

View file

@ -861,7 +861,7 @@ STRINGEND;
*
* @return void
*/
static function nameVariations() {
public static function nameVariations() {
return array(
array('BakeArticles'), array('BakeArticle'), array('bake_article'), array('bake_articles')
);

View file

@ -99,6 +99,7 @@ class TestTaskArticle extends Model {
*/
protected function _innerMethod() {
}
}
/**
@ -538,7 +539,6 @@ class TestTaskTest extends CakeTestCase {
$this->assertEquals($expected, $result);
}
/**
* Test that mock class generation works for the appropriate classes
*

View file

@ -119,6 +119,7 @@ class ViewTaskCommentsController extends Controller {
*/
public function add() {
}
}
/**
@ -191,6 +192,7 @@ class ViewTaskArticlesController extends Controller {
*/
public function admin_delete() {
}
}
/**
@ -607,7 +609,6 @@ class ViewTaskTest extends CakeTestCase {
$this->Task->expects($this->any())->method('in')
->will($this->onConsecutiveCalls('y', 'y', 'n'));
$this->Task->expects($this->at(3))->method('createFile')
->with(
TMP . 'ViewTaskComments' . DS . 'index.ctp',

View file

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

View file

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

View file

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

View file

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