From d8d7b899a1143a2fc26047e8cc92edf8107d176e Mon Sep 17 00:00:00 2001 From: phpnut Date: Wed, 26 Mar 2008 03:02:13 +0000 Subject: [PATCH] "Adding additional test to show how to load files that do not follow directory naming or file naming conventions. References #4319, References #4334" git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6600 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/tests/cases/libs/loader.test.php | 18 +++++++++++ cake/tests/test_app/vendors/Test/MyTest.php | 30 +++++++++++++++++++ cake/tests/test_app/vendors/Test/hello.php | 30 +++++++++++++++++++ .../test_app/vendors/somename/some.name.php | 30 +++++++++++++++++++ 4 files changed, 108 insertions(+) create mode 100644 cake/tests/test_app/vendors/Test/MyTest.php create mode 100644 cake/tests/test_app/vendors/Test/hello.php create mode 100644 cake/tests/test_app/vendors/somename/some.name.php diff --git a/cake/tests/cases/libs/loader.test.php b/cake/tests/cases/libs/loader.test.php index 0cb23c79c..f8a36feab 100644 --- a/cake/tests/cases/libs/loader.test.php +++ b/cake/tests/cases/libs/loader.test.php @@ -186,6 +186,24 @@ class AppImportTest extends UnitTestCase { $result = App::import('Vendor', 'Sample'); $this->assertTrue($result); $this->assertTrue(class_exists('SampleClassTestName')); + + ob_start(); + $result = App::import('Vendor', 'SomeName', array('file' => 'some.name.php')); + $text = ob_get_clean(); + $this->assertTrue($result); + $this->assertEqual($text, 'This is a file with dot in file name'); + + ob_start(); + $result = App::import('Vendor', 'TestHello', array('file' => 'Test'.DS.'hello.php')); + $text = ob_get_clean(); + $this->assertTrue($result); + $this->assertEqual($text, 'This is the hello.php file in Test directoy'); + + ob_start(); + $result = App::import('Vendor', 'MyTest', array('file' => 'Test'.DS.'MyTest.php')); + $text = ob_get_clean(); + $this->assertTrue($result); + $this->assertEqual($text, 'This is the MyTest.php file'); } } ?> \ No newline at end of file diff --git a/cake/tests/test_app/vendors/Test/MyTest.php b/cake/tests/test_app/vendors/Test/MyTest.php new file mode 100644 index 000000000..ed992d6c6 --- /dev/null +++ b/cake/tests/test_app/vendors/Test/MyTest.php @@ -0,0 +1,30 @@ + + * 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.vendors.somename + * @since CakePHP(tm) v 1.2.0.4206 + * @version $Revision$ + * @modifiedby $LastChangedBy$ + * @lastmodified $Date$ + * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License + */ +?> +This is the MyTest.php file \ No newline at end of file diff --git a/cake/tests/test_app/vendors/Test/hello.php b/cake/tests/test_app/vendors/Test/hello.php new file mode 100644 index 000000000..c1b3f3b86 --- /dev/null +++ b/cake/tests/test_app/vendors/Test/hello.php @@ -0,0 +1,30 @@ + + * 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.vendors.Test + * @since CakePHP(tm) v 1.2.0.4206 + * @version $Revision$ + * @modifiedby $LastChangedBy$ + * @lastmodified $Date$ + * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License + */ +?> +This is the hello.php file in Test directoy \ No newline at end of file diff --git a/cake/tests/test_app/vendors/somename/some.name.php b/cake/tests/test_app/vendors/somename/some.name.php new file mode 100644 index 000000000..0741d2c10 --- /dev/null +++ b/cake/tests/test_app/vendors/somename/some.name.php @@ -0,0 +1,30 @@ + + * 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.vendors.somename + * @since CakePHP(tm) v 1.2.0.4206 + * @version $Revision$ + * @modifiedby $LastChangedBy$ + * @lastmodified $Date$ + * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License + */ +?> +This is a file with dot in file name \ No newline at end of file