Skip to content

Commit

Permalink
Adding tests for loading helpers off of additional paths. Closes #410
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Mar 25, 2010
1 parent 3883f72 commit 9334aea
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
21 changes: 20 additions & 1 deletion cake/tests/cases/libs/configure.test.php
Expand Up @@ -301,7 +301,7 @@ function testVersion() {
* @package cake
* @subpackage cake.tests.cases.libs
*/
class AppImportTest extends UnitTestCase {
class AppImportTest extends CakeTestCase {

/**
* testBuild method
Expand Down Expand Up @@ -581,8 +581,27 @@ function testClassLoading() {
$result = App::import('Datasource', 'TestPlugin.TestSource');
$this->assertTrue($result);
$this->assertTrue(class_exists('TestSource'));
App::build();
}

/**
* test that building helper paths actually works.
*
* @return void
* @link http://cakephp.lighthouseapp.com/projects/42648/tickets/410
*/
function testImportingHelpersFromAlternatePaths() {
App::build();
$this->assertFalse(class_exists('BananaHelper'), 'BananaHelper exists, cannot test importing it.');
App::import('Helper', 'Banana');
$this->assertFalse(class_exists('BananaHelper'), 'BananaHelper was not found because the path does not exist.');

App::build(array(
'helpers' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'helpers' . DS)
));
$this->assertFalse(class_exists('BananaHelper'), 'BananaHelper exists, cannot test importing it.');
App::import('Helper', 'Banana');
$this->assertTrue(class_exists('BananaHelper'), 'BananaHelper was not loaded.');
}

/**
Expand Down
21 changes: 21 additions & 0 deletions cake/tests/test_app/views/helpers/banana.php
@@ -0,0 +1,21 @@
<?php
/**
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.view.templates.layouts
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class BananaHelper extends Helper {

}

0 comments on commit 9334aea

Please sign in to comment.