Fixing test_app/test_plugin files. Many had incorrect file / class names. Added tests to cover plugin class loading, and dispatching.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7355 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mark_story 2008-07-24 02:19:05 +00:00
parent d6d7bd68bd
commit d7b043a374
9 changed files with 106 additions and 22 deletions

View file

@ -1245,6 +1245,24 @@ class DispatcherTest extends CakeTestCase {
$expected = 'privateAction';
$this->assertIdentical($expected, $controller);
}
/**
* undocumented function
*
* @return void
**/
function testTestPluginDispatch() {
$Dispatcher =& new TestDispatcher();
$_back = Configure::read('pluginPaths');
Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS));
$url = '/test_plugin/tests/index';
$result = $Dispatcher->dispatch($url, array('return' => 1));
$this->assertTrue(class_exists('TestsController'));
$this->assertTrue(class_exists('TestPluginAppController'));
$this->assertTrue(class_exists('OtherComponentComponent'));
$this->assertTrue(class_exists('PluginsComponentComponent'));
Configure::write('pluginPaths', $_back);
}
/**
* testChangingParamsFromBeforeFilter method
*

View file

@ -371,11 +371,11 @@ class AppImportTest extends UnitTestCase {
$result = App::import('Controller', 'TestPlugin.Tests');
$this->assertTrue($result);
$this->assertTrue(class_exists('TestPluginAppController'));
$this->assertTrue(class_exists('TestPluginTestsController'));
$this->assertTrue(class_exists('TestsController'));
$result = App::import('Helper', 'TestPlugin.OtherHelper');
$this->assertTrue($result);
$this->assertTrue(class_exists('TestPluginOtherHelperHelper'));
$this->assertTrue(class_exists('OtherHelperHelper'));
Configure::write('pluginPaths', $_back);
}

View file

@ -448,9 +448,9 @@ class ViewTest extends CakeTestCase {
$this->assertTrue(is_object($result['Ajax']->Html));
$View->plugin = 'test_plugin';
$result = $View->loadHelpers($loaded, array('TestPlugin.TestPluginHelper'));
$this->assertTrue(is_object($result['TestPluginHelper']));
$this->assertTrue(is_object($result['TestPluginHelper']->TestPluginOtherHelper));
$result = $View->loadHelpers($loaded, array('TestPlugin.PluggedHelper'));
$this->assertTrue(is_object($result['PluggedHelper']));
$this->assertTrue(is_object($result['PluggedHelper']->OtherHelper));
}
/**
* testBeforeLayout method
@ -501,7 +501,7 @@ class ViewTest extends CakeTestCase {
$this->assertTrue(is_object($helpers['form']->Html));
$this->assertTrue(is_object($helpers['ajax']->Html));
$this->PostsController->helpers = array('Html', 'Form', 'Ajax', 'TestPlugin.TestPluginHelper');
$this->PostsController->helpers = array('Html', 'Form', 'Ajax', 'TestPlugin.PluggedHelper');
$View = new TestView($this->PostsController);
$result = $View->_render($View->getViewFileName('index'), array());
@ -512,7 +512,7 @@ class ViewTest extends CakeTestCase {
$this->assertTrue(is_object($helpers['form']));
$this->assertTrue(is_object($helpers['form']->Html));
$this->assertTrue(is_object($helpers['ajax']->Html));
$this->assertTrue(is_object($helpers['testPluginHelper']->TestPluginOtherHelper));
$this->assertTrue(is_object($helpers['pluggedHelper']->OtherHelper));
}
/**
* testRender method

View file

@ -26,5 +26,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
class TestPluginOtherHelperHelper extends AppHelper{}
class OtherComponentComponent extends Object {
}
?>

View file

@ -0,0 +1,33 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2008, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @subpackage cake.tests.test_app.plugins.test_plugin.views.helpers
* @since CakePHP(tm) v 1.2.0.4206
* @version $Rev$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
class PluginsComponentComponent extends Object {
var $components = array('TestPlugin.OtherComponent');
}
?>

View file

@ -0,0 +1,42 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2008, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @subpackage cake.tests.test_app.plugins.test_plugin.views.helpers
* @since CakePHP(tm) v 1.2.0.4206
* @version $Rev$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
class TestsController extends AppController {
var $name = 'Tests';
var $uses = array();
var $helpers = array('TestPlugin.OtherHelper', 'Html');
var $components = array('TestPlugin.PluginsComponent');
function index() {
}
function some_method() {
return 25;
}
}
?>

View file

@ -26,15 +26,5 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
class TestsPluginsTestsController extends AppController {
var $name = 'TestsPluginsTests';
var $uses = array();
function index() {
}
function some_method() {
return 25;
}
}
class OtherHelperHelper extends AppHelper {}
?>

View file

@ -26,8 +26,8 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
class TestPluginHelperHelper extends AppHelper {
class PluggedHelperHelper extends AppHelper {
var $helpers = array('TestPlugin.TestPluginOtherHelper');
var $helpers = array('TestPlugin.OtherHelper');
}
?>

View file

@ -1 +0,0 @@
This is the TestsPluginsTestsController index view