diff options
author | Jonathon Hill <jhill@brandmovers.com> | 2012-11-12 14:51:41 +0100 |
---|---|---|
committer | Jonathon Hill <jhill@brandmovers.com> | 2012-11-12 14:51:41 +0100 |
commit | 3978fc33d82dd7f778d1adbf30744f4dfac41c25 (patch) | |
tree | f32be1ae610f0cfeff65c35abecd14e8ea5cadc6 /tests | |
parent | 275cf274860c6ed181d50b398efd3a21d7ba9135 (diff) | |
parent | a9ab46d7a031bda304eb9b6658ffaf693b8d9bcb (diff) |
Merge remote-tracking branch 'upstream/develop' into develop
Conflicts:
user_guide_src/source/changelog.rst
Signed-off-by: Jonathon Hill <jhill@brandmovers.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/codeigniter/core/Loader_test.php | 1 | ||||
-rw-r--r-- | tests/codeigniter/database/DB_driver_test.php | 2 | ||||
-rw-r--r-- | tests/codeigniter/helpers/directory_helper_test.php | 8 | ||||
-rw-r--r-- | tests/codeigniter/helpers/form_helper_test.php | 15 | ||||
-rw-r--r-- | tests/mocks/autoloader.php | 19 | ||||
-rw-r--r-- | tests/mocks/database/db/driver.php | 1 | ||||
-rw-r--r-- | tests/mocks/database/schema/skeleton.php | 6 |
7 files changed, 32 insertions, 20 deletions
diff --git a/tests/codeigniter/core/Loader_test.php b/tests/codeigniter/core/Loader_test.php index 816587a49..ecc5ca933 100644 --- a/tests/codeigniter/core/Loader_test.php +++ b/tests/codeigniter/core/Loader_test.php @@ -493,7 +493,6 @@ class Loader_test extends CI_TestCase { ); $this->ci_vfs_create('autoload', '<?php $autoload = '.var_export($cfg, TRUE).';', $this->ci_app_root, 'config'); - // Run initialize and autoloader $this->load->initialize(); // Verify path diff --git a/tests/codeigniter/database/DB_driver_test.php b/tests/codeigniter/database/DB_driver_test.php index 9e16e29b4..1f48ca984 100644 --- a/tests/codeigniter/database/DB_driver_test.php +++ b/tests/codeigniter/database/DB_driver_test.php @@ -5,7 +5,7 @@ class DB_driver_test extends CI_TestCase { public function test_initialize() { $config = Mock_Database_DB::config(DB_DRIVER); - $driver_name = current(explode('/', DB_DRIVER)); + sscanf(DB_DRIVER, '%[^/]/', $driver_name); $driver = $this->$driver_name($config[DB_DRIVER]); $this->assertTrue($driver->initialize()); diff --git a/tests/codeigniter/helpers/directory_helper_test.php b/tests/codeigniter/helpers/directory_helper_test.php index c39ccd8d0..41370e6e7 100644 --- a/tests/codeigniter/helpers/directory_helper_test.php +++ b/tests/codeigniter/helpers/directory_helper_test.php @@ -28,9 +28,9 @@ class Directory_helper_test extends CI_TestCase { // test default recursive behavior $expected = array( - 'libraries' => array( + 'libraries/' => array( 'benchmark.html', - 'database' => array('active_record.html', 'binds.html'), + 'database/' => array('active_record.html', 'binds.html'), 'email.html', '0' ) @@ -39,12 +39,12 @@ class Directory_helper_test extends CI_TestCase { $this->assertEquals($expected, directory_map(vfsStream::url('testDir'))); // test detection of hidden files - $expected['libraries'][] = '.hiddenfile.txt'; + $expected['libraries/'][] = '.hiddenfile.txt'; $this->assertEquals($expected, directory_map(vfsStream::url('testDir'), FALSE, TRUE)); // test recursion depth behavior - $this->assertEquals(array('libraries'), directory_map(vfsStream::url('testDir'), 1)); + $this->assertEquals(array('libraries/'), directory_map(vfsStream::url('testDir'), 1)); } } diff --git a/tests/codeigniter/helpers/form_helper_test.php b/tests/codeigniter/helpers/form_helper_test.php index 03278581d..89165271e 100644 --- a/tests/codeigniter/helpers/form_helper_test.php +++ b/tests/codeigniter/helpers/form_helper_test.php @@ -272,6 +272,21 @@ EOH; $this->assertEquals($expected, form_close('</div></div>')); } + // ------------------------------------------------------------------------ + + public function test_form_prep() + { + $this->assertEquals( + 'Here is a string containing "quoted" text.', + form_prep('Here is a string containing "quoted" text.') + ); + + $this->assertEquals( + 'Here is a string containing a <tag>.', + form_prep('Here is a string containing a <tag>.', TRUE) + ); + } + } /* End of file form_helper_test.php */
\ No newline at end of file diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php index 5b202f159..3d216da1f 100644 --- a/tests/mocks/autoloader.php +++ b/tests/mocks/autoloader.php @@ -16,7 +16,7 @@ function autoload($class) $ci_core = array( 'Benchmark', 'Config', 'Controller', 'Exceptions', 'Hooks', 'Input', - 'Lang', 'Loader', 'Model', + 'Lang', 'Loader', 'Log', 'Model', 'Output', 'Router', 'Security', 'URI', 'Utf8', ); @@ -25,11 +25,10 @@ function autoload($class) 'Calendar', 'Cart', 'Driver_Library', 'Email', 'Encrypt', 'Form_validation', 'Ftp', 'Image_lib', 'Javascript', - 'Log', 'Migration', 'Pagination', - 'Parser', 'Profiler', 'Table', - 'Trackback', 'Typography', 'Unit_test', - 'Upload', 'User_agent', 'Xmlrpc', - 'Zip', + 'Migration', 'Pagination', 'Parser', + 'Profiler', 'Table', 'Trackback', + 'Typography', 'Unit_test', 'Upload', + 'User_agent', 'Xmlrpc', 'Zip' ); $ci_drivers = array( @@ -38,13 +37,11 @@ function autoload($class) if (strpos($class, 'Mock_') === 0) { - $class = str_replace(array('Mock_', '_'), array('', DIRECTORY_SEPARATOR), $class); - $class = strtolower($class); + $class = strtolower(str_replace(array('Mock_', '_'), array('', DIRECTORY_SEPARATOR), $class)); } elseif (strpos($class, 'CI_') === 0) { - $fragments = explode('_', $class, 2); - $subclass = next($fragments); + $subclass = substr($class, 3); if (in_array($subclass, $ci_core)) { @@ -88,7 +85,7 @@ function autoload($class) } } - $file = (isset($file)) ? $file : $dir.$class.'.php'; + $file = isset($file) ? $file : $dir.$class.'.php'; if ( ! file_exists($file)) { diff --git a/tests/mocks/database/db/driver.php b/tests/mocks/database/db/driver.php index 65ac2c4cc..2cf54b97b 100644 --- a/tests/mocks/database/db/driver.php +++ b/tests/mocks/database/db/driver.php @@ -34,6 +34,7 @@ class Mock_Database_DB_Driver extends CI_DB_driver { return call_user_func_array(array($this->ci_db_driver, $method), $arguments); } + } class CI_DB extends Mock_Database_DB_QueryBuilder {}
\ No newline at end of file diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php index d72244528..e5c536090 100644 --- a/tests/mocks/database/schema/skeleton.php +++ b/tests/mocks/database/schema/skeleton.php @@ -69,7 +69,7 @@ class Mock_Database_Schema_Skeleton { ) )); static::$forge->add_key('id', TRUE); - static::$forge->create_table('user', (strpos(static::$driver, 'pgsql') === FALSE)); + static::$forge->create_table('user', TRUE); // Job Table static::$forge->add_field(array( @@ -86,7 +86,7 @@ class Mock_Database_Schema_Skeleton { ) )); static::$forge->add_key('id', TRUE); - static::$forge->create_table('job', (strpos(static::$driver, 'pgsql') === FALSE)); + static::$forge->create_table('job', TRUE); // Misc Table static::$forge->add_field(array( @@ -103,7 +103,7 @@ class Mock_Database_Schema_Skeleton { ) )); static::$forge->add_key('id', TRUE); - static::$forge->create_table('misc', (strpos(static::$driver, 'pgsql') === FALSE)); + static::$forge->create_table('misc', TRUE); } /** |