Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding tests for loading helpers off of additional paths. Closes #410

  • Loading branch information...
commit 9334aeabc2a0e2a7ef3190525afb981cde725c28 1 parent 3883f72
@markstory markstory authored
View
21 cake/tests/cases/libs/configure.test.php
@@ -301,7 +301,7 @@ function testVersion() {
* @package cake
* @subpackage cake.tests.cases.libs
*/
-class AppImportTest extends UnitTestCase {
+class AppImportTest extends CakeTestCase {
/**
* testBuild method
@@ -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.');
}
/**
View
21 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 {
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.