mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
closes #4000, added test case to show ext functionality is working as expected
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7248 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
91d86b91a4
commit
73eab59ada
1 changed files with 68 additions and 49 deletions
|
@ -31,43 +31,43 @@ App::import('Component', 'Security');
|
|||
App::import('Component', 'Cookie');
|
||||
/**
|
||||
* ControllerPost class
|
||||
*
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class ControllerPost extends CakeTestModel {
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
*
|
||||
* @var string 'ControllerPost'
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'ControllerPost';
|
||||
/**
|
||||
* useTable property
|
||||
*
|
||||
*
|
||||
* @var string 'posts'
|
||||
* @access public
|
||||
*/
|
||||
var $useTable = 'posts';
|
||||
/**
|
||||
* invalidFields property
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $invalidFields = array('name' => 'error_msg');
|
||||
/**
|
||||
* lastQuery property
|
||||
*
|
||||
*
|
||||
* @var mixed null
|
||||
* @access public
|
||||
*/
|
||||
var $lastQuery = null;
|
||||
/**
|
||||
* beforeFind method
|
||||
*
|
||||
* @param mixed $query
|
||||
*
|
||||
* @param mixed $query
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -76,9 +76,9 @@ class ControllerPost extends CakeTestModel {
|
|||
}
|
||||
/**
|
||||
* find method
|
||||
*
|
||||
* @param mixed $type
|
||||
* @param array $options
|
||||
*
|
||||
* @param mixed $type
|
||||
* @param array $options
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -93,35 +93,35 @@ class ControllerPost extends CakeTestModel {
|
|||
}
|
||||
/**
|
||||
* ControllerComment class
|
||||
*
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class ControllerComment extends CakeTestModel {
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
*
|
||||
* @var string 'ControllerComment'
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'ControllerComment';
|
||||
/**
|
||||
* useTable property
|
||||
*
|
||||
*
|
||||
* @var string 'comments'
|
||||
* @access public
|
||||
*/
|
||||
var $useTable = 'comments';
|
||||
/**
|
||||
* data property
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $data = array('name' => 'Some Name');
|
||||
/**
|
||||
* alias property
|
||||
*
|
||||
*
|
||||
* @var string 'ControllerComment'
|
||||
* @access public
|
||||
*/
|
||||
|
@ -130,28 +130,28 @@ class ControllerComment extends CakeTestModel {
|
|||
if (!class_exists('AppController')) {
|
||||
/**
|
||||
* AppController class
|
||||
*
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class AppController extends Controller {
|
||||
/**
|
||||
* helpers property
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $helpers = array('Html', 'Javascript');
|
||||
/**
|
||||
* uses property
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $uses = array('ControllerPost');
|
||||
/**
|
||||
* components property
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
|
@ -162,37 +162,37 @@ if (!class_exists('AppController')) {
|
|||
}
|
||||
/**
|
||||
* TestController class
|
||||
*
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class TestController extends AppController {
|
||||
/**
|
||||
* helpers property
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $helpers = array('Xml');
|
||||
/**
|
||||
* components property
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $components = array('Security');
|
||||
/**
|
||||
* uses property
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $uses = array('ControllerComment');
|
||||
/**
|
||||
* index method
|
||||
*
|
||||
* @param mixed $testId
|
||||
* @param mixed $test2Id
|
||||
*
|
||||
* @param mixed $testId
|
||||
* @param mixed $test2Id
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -203,14 +203,14 @@ class TestController extends AppController {
|
|||
}
|
||||
/**
|
||||
* TestComponent class
|
||||
*
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class TestComponent extends Object {
|
||||
/**
|
||||
* beforeRedirect method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -227,14 +227,14 @@ class TestComponent extends Object {
|
|||
class ControllerTest extends CakeTestCase {
|
||||
/**
|
||||
* fixtures property
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $fixtures = array('core.post', 'core.comment');
|
||||
/**
|
||||
* testConstructClasses method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -258,7 +258,7 @@ class ControllerTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testPersistent method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -276,7 +276,7 @@ class ControllerTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testPaginate method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -306,7 +306,7 @@ class ControllerTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testPaginateExtraParams method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -337,7 +337,7 @@ class ControllerTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testDefaultPaginateParams method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -354,7 +354,7 @@ class ControllerTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testFlash method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -384,7 +384,7 @@ class ControllerTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testControllerSet method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -417,7 +417,7 @@ class ControllerTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testRender method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -435,7 +435,7 @@ class ControllerTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testToBeInheritedGuardmethods method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -448,7 +448,7 @@ class ControllerTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testCleanUpFields method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -459,7 +459,7 @@ class ControllerTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testRedirect method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -521,7 +521,7 @@ class ControllerTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testMergeVars method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -533,7 +533,7 @@ class ControllerTest extends CakeTestCase {
|
|||
|
||||
$testVars = get_class_vars('TestController');
|
||||
$appVars = get_class_vars('AppController');
|
||||
|
||||
|
||||
$components = is_array($appVars['components'])
|
||||
? array_merge($appVars['components'], $testVars['components'])
|
||||
: $testVars['components'];
|
||||
|
@ -546,14 +546,14 @@ class ControllerTest extends CakeTestCase {
|
|||
$uses = is_array($appVars['uses'])
|
||||
? array_merge($appVars['uses'], $testVars['uses'])
|
||||
: $testVars['uses'];
|
||||
|
||||
|
||||
$this->assertEqual(count(array_diff($TestController->helpers, $helpers)), 0);
|
||||
$this->assertEqual(count(array_diff($TestController->uses, $uses)), 0);
|
||||
$this->assertEqual(count(array_diff_assoc(Set::normalize($TestController->components), Set::normalize($components))), 0);
|
||||
}
|
||||
/**
|
||||
* testReferer method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -592,7 +592,7 @@ class ControllerTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testSetAction method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -604,7 +604,7 @@ class ControllerTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testUnimplementedIsAuthorized method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -615,7 +615,7 @@ class ControllerTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testValidateErrors method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -636,7 +636,7 @@ class ControllerTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testPostConditions method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -698,5 +698,24 @@ class ControllerTest extends CakeTestCase {
|
|||
$result = $Controller->postConditions($data, $ops);
|
||||
$this->assertIdentical($result, $expected);
|
||||
}
|
||||
/**
|
||||
* testRequestHandlerPrefers method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRequestHandlerPrefers(){
|
||||
$Controller =& new Controller();
|
||||
$Controller->components = array("RequestHandler");
|
||||
$Controller->modelClass='ControllerPost';
|
||||
$Controller->params['url']['ext'] = 'rss';
|
||||
$Controller->constructClasses();
|
||||
$Controller->Component->initialize($Controller);
|
||||
$Controller->beforeFilter();
|
||||
$Controller->Component->startup($Controller);
|
||||
|
||||
$this->assertEqual($Controller->RequestHandler->prefers(), 'rss');
|
||||
unset($Controller);
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
Loading…
Reference in a new issue