Skip to content

Commit

Permalink
Fix coding standards in Case/Core
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Mar 13, 2012
1 parent a2fb417 commit b4a444f
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 63 deletions.
37 changes: 23 additions & 14 deletions lib/Cake/Test/Case/Core/AppTest.php
Expand Up @@ -165,7 +165,7 @@ public function testCompatibleBuild() {
App::build(array('helpers' => array('/path/to/helpers/')));
$expected = array(
'/path/to/helpers/',
APP . 'View' . DS . 'Helper' .DS
APP . 'View' . DS . 'Helper' . DS
);
$result = App::path('helpers');
$this->assertEquals($expected, $result);
Expand Down Expand Up @@ -598,7 +598,6 @@ public function testPluginImporting() {
* @link http://cakephp.lighthouseapp.com/projects/42648/tickets/410
*/
public function testImportingHelpersFromAlternatePaths() {

$this->assertFalse(class_exists('BananaHelper', false), 'BananaHelper exists, cannot test importing it.');
App::build(array(
'View/Helper' => array(
Expand All @@ -618,10 +617,10 @@ public function testImportingHelpersFromAlternatePaths() {
* @return void
*/
public function testFileLoading() {
$file = App::import('File', 'RealFile', false, array(), CAKE . 'Config' . DS . 'config.php');
$file = App::import('File', 'RealFile', false, array(), CAKE . 'Config' . DS . 'config.php');
$this->assertTrue($file);

$file = App::import('File', 'NoFile', false, array(), CAKE . 'Config' . DS . 'cake' . DS . 'config.php');
$file = App::import('File', 'NoFile', false, array(), CAKE . 'Config' . DS . 'cake' . DS . 'config.php');
$this->assertFalse($file);
}

Expand All @@ -631,13 +630,21 @@ public function testFileLoading() {
* @return void
*/
public function testFileLoadingWithArray() {
$type = array('type' => 'File', 'name' => 'SomeName', 'parent' => false,
'file' => CAKE . DS . 'Config' . DS . 'config.php');
$type = array(
'type' => 'File',
'name' => 'SomeName',
'parent' => false,
'file' => CAKE . DS . 'Config' . DS . 'config.php'
);
$file = App::import($type);
$this->assertTrue($file);

$type = array('type' => 'File', 'name' => 'NoFile', 'parent' => false,
'file' => CAKE . 'Config' . DS . 'cake' . DS . 'config.php');
$type = array(
'type' => 'File',
'name' => 'NoFile',
'parent' => false,
'file' => CAKE . 'Config' . DS . 'cake' . DS . 'config.php'
);
$file = App::import($type);
$this->assertFalse($file);
}
Expand All @@ -648,13 +655,17 @@ public function testFileLoadingWithArray() {
* @return void
*/
public function testFileLoadingReturnValue() {
$file = App::import('File', 'Name', false, array(), CAKE . 'Config' . DS . 'config.php', true);
$file = App::import('File', 'Name', false, array(), CAKE . 'Config' . DS . 'config.php', true);
$this->assertTrue(!empty($file));

$this->assertTrue(isset($file['Cake.version']));

$type = array('type' => 'File', 'name' => 'OtherName', 'parent' => false,
'file' => CAKE . 'Config' . DS . 'config.php', 'return' => true);
$type = array(
'type' => 'File',
'name' => 'OtherName',
'parent' => false,
'file' => CAKE . 'Config' . DS . 'config.php', 'return' => true
);
$file = App::import($type);
$this->assertTrue(!empty($file));

Expand Down Expand Up @@ -719,19 +730,17 @@ public function testMultipleLoading() {

$classes = array_flip(get_declared_classes());


$this->assertTrue(isset($classes['PersisterOne']));
$this->assertTrue(isset($classes['PersisterTwo']));

$load = App::import('Model', array('PersisterOne', 'SomeNotFoundClass', 'PersisterTwo'));
$this->assertFalse($load);
}


public function testLoadingVendor() {
App::build(array(
'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS),
'vendors' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor'. DS),
'vendors' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor' . DS),
), App::RESET);
CakePlugin::load(array('TestPlugin', 'TestPluginTwo'));

Expand Down
2 changes: 0 additions & 2 deletions lib/Cake/Test/Case/Core/CakePluginTest.php
Expand Up @@ -157,7 +157,6 @@ public function testMultipleBootstrapFiles() {
$this->assertEquals('loaded plugin bootstrap', Configure::read('CakePluginTest.test_plugin.bootstrap'));
}


/**
* Tests that it is possible to load plugin bootstrap by calling a callback function
*
Expand Down Expand Up @@ -190,7 +189,6 @@ public function testLoadNotFound() {
CakePlugin::load('MissingPlugin');
}


/**
* Tests that CakePlugin::path() returns the correct path for the loaded plugins
*
Expand Down
100 changes: 53 additions & 47 deletions lib/Cake/Test/Case/Core/ObjectTest.php
Expand Up @@ -52,31 +52,31 @@ class RequestActionPost extends CakeTestModel {
class RequestActionController extends Controller {

/**
* uses property
*
* @var array
* @access public
*/
* uses property
*
* @var array
* @access public
*/
public $uses = array('RequestActionPost');

/**
* test_request_action method
*
* @access public
* @return void
*/
* test_request_action method
*
* @access public
* @return void
*/
public function test_request_action() {
return 'This is a test';
}

/**
* another_ra_test method
*
* @param mixed $id
* @param mixed $other
* @access public
* @return void
*/
* another_ra_test method
*
* @param mixed $id
* @param mixed $other
* @access public
* @return void
*/
public function another_ra_test($id, $other) {
return $id + $other;
}
Expand Down Expand Up @@ -135,8 +135,8 @@ public function param_check() {
}
$this->response->body($content);
}
}

}

/**
* TestObject class
Expand Down Expand Up @@ -189,64 +189,66 @@ public function oneParamMethod($param) {
* twoParamMethod method
*
* @param mixed $param
* @param mixed $param2
* @param mixed $paramTwo
* @return void
*/
public function twoParamMethod($param, $param2) {
$this->methodCalls[] = array('twoParamMethod' => array($param, $param2));
public function twoParamMethod($param, $paramTwo) {
$this->methodCalls[] = array('twoParamMethod' => array($param, $paramTwo));
}

/**
* threeParamMethod method
*
* @param mixed $param
* @param mixed $param2
* @param mixed $param3
* @param mixed $paramTwo
* @param mixed $paramThree
* @return void
*/
public function threeParamMethod($param, $param2, $param3) {
$this->methodCalls[] = array('threeParamMethod' => array($param, $param2, $param3));
public function threeParamMethod($param, $paramTwo, $paramThree) {
$this->methodCalls[] = array('threeParamMethod' => array($param, $paramTwo, $paramThree));
}
/**

/**
* fourParamMethod method
*
* @param mixed $param
* @param mixed $param2
* @param mixed $param3
* @param mixed $param4
* @param mixed $paramTwo
* @param mixed $paramThree
* @param mixed $paramFour
* @return void
*/
public function fourParamMethod($param, $param2, $param3, $param4) {
$this->methodCalls[] = array('fourParamMethod' => array($param, $param2, $param3, $param4));
public function fourParamMethod($param, $paramTwo, $paramThree, $paramFour) {
$this->methodCalls[] = array('fourParamMethod' => array($param, $paramTwo, $paramThree, $paramFour));
}
/**

/**
* fiveParamMethod method
*
* @param mixed $param
* @param mixed $param2
* @param mixed $param3
* @param mixed $param4
* @param mixed $param5
* @param mixed $paramTwo
* @param mixed $paramThree
* @param mixed $paramFour
* @param mixed $paramFive
* @return void
*/
public function fiveParamMethod($param, $param2, $param3, $param4, $param5) {
$this->methodCalls[] = array('fiveParamMethod' => array($param, $param2, $param3, $param4, $param5));
public function fiveParamMethod($param, $paramTwo, $paramThree, $paramFour, $paramFive) {
$this->methodCalls[] = array('fiveParamMethod' => array($param, $paramTwo, $paramThree, $paramFour, $paramFive));
}

/**
* crazyMethod method
*
* @param mixed $param
* @param mixed $param2
* @param mixed $param3
* @param mixed $param4
* @param mixed $param5
* @param mixed $param6
* @param mixed $param7
* @param mixed $paramTwo
* @param mixed $paramThree
* @param mixed $paramFour
* @param mixed $paramFive
* @param mixed $paramSix
* @param mixed $paramSeven
* @return void
*/
public function crazyMethod($param, $param2, $param3, $param4, $param5, $param6, $param7 = null) {
$this->methodCalls[] = array('crazyMethod' => array($param, $param2, $param3, $param4, $param5, $param6, $param7));
public function crazyMethod($param, $paramTwo, $paramThree, $paramFour, $paramFive, $paramSix, $paramSeven = null) {
$this->methodCalls[] = array('crazyMethod' => array($param, $paramTwo, $paramThree, $paramFour, $paramFive, $paramSix, $paramSeven));
}

/**
Expand All @@ -267,6 +269,7 @@ public function methodWithOptionalParam($param = null) {
public function set($properties = array()) {
return parent::_set($properties);
}

}

/**
Expand All @@ -275,8 +278,11 @@ public function set($properties = array()) {
* @package Cake.Test.Case.Core
*/
class ObjectTestModel extends CakeTestModel {

public $useTable = false;

public $name = 'ObjectTestModel';

}

/**
Expand Down Expand Up @@ -528,7 +534,7 @@ public function testRequestActionArray() {
'Model' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS),
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS),
'Controller' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Controller' . DS),
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin'. DS)
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
), App::RESET);
CakePlugin::load(array('TestPlugin'));

Expand Down

0 comments on commit b4a444f

Please sign in to comment.