mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix coding standards in Case/Core
This commit is contained in:
parent
a2fb4178fb
commit
b4a444fb14
3 changed files with 76 additions and 63 deletions
|
@ -165,7 +165,7 @@ class AppTest extends CakeTestCase {
|
|||
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);
|
||||
|
@ -598,7 +598,6 @@ class AppTest extends CakeTestCase {
|
|||
* @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(
|
||||
|
@ -618,10 +617,10 @@ class AppTest extends CakeTestCase {
|
|||
* @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);
|
||||
}
|
||||
|
||||
|
@ -631,13 +630,21 @@ class AppTest extends CakeTestCase {
|
|||
* @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);
|
||||
}
|
||||
|
@ -648,13 +655,17 @@ class AppTest extends CakeTestCase {
|
|||
* @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));
|
||||
|
||||
|
@ -719,7 +730,6 @@ class AppTest extends CakeTestCase {
|
|||
|
||||
$classes = array_flip(get_declared_classes());
|
||||
|
||||
|
||||
$this->assertTrue(isset($classes['PersisterOne']));
|
||||
$this->assertTrue(isset($classes['PersisterTwo']));
|
||||
|
||||
|
@ -727,11 +737,10 @@ class AppTest extends CakeTestCase {
|
|||
$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'));
|
||||
|
||||
|
|
|
@ -157,7 +157,6 @@ class CakePluginTest extends CakeTestCase {
|
|||
$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
|
||||
*
|
||||
|
@ -190,7 +189,6 @@ class CakePluginTest extends CakeTestCase {
|
|||
CakePlugin::load('MissingPlugin');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests that CakePlugin::path() returns the correct path for the loaded plugins
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
@ -135,8 +135,8 @@ class RequestActionController extends Controller {
|
|||
}
|
||||
$this->response->body($content);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* TestObject class
|
||||
|
@ -189,64 +189,66 @@ class TestObject extends Object {
|
|||
* 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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -267,6 +269,7 @@ class TestObject extends Object {
|
|||
public function set($properties = array()) {
|
||||
return parent::_set($properties);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -275,8 +278,11 @@ class TestObject extends Object {
|
|||
* @package Cake.Test.Case.Core
|
||||
*/
|
||||
class ObjectTestModel extends CakeTestModel {
|
||||
|
||||
public $useTable = false;
|
||||
|
||||
public $name = 'ObjectTestModel';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -528,7 +534,7 @@ class ObjectTest extends CakeTestCase {
|
|||
'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'));
|
||||
|
||||
|
|
Loading…
Reference in a new issue