summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/codeigniter/database/DB_driver_test.php2
-rw-r--r--tests/mocks/autoloader.php8
2 files changed, 4 insertions, 6 deletions
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/mocks/autoloader.php b/tests/mocks/autoloader.php
index 5b202f159..4fc9c63b6 100644
--- a/tests/mocks/autoloader.php
+++ b/tests/mocks/autoloader.php
@@ -38,13 +38,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 +86,7 @@ function autoload($class)
}
}
- $file = (isset($file)) ? $file : $dir.$class.'.php';
+ $file = isset($file) ? $file : $dir.$class.'.php';
if ( ! file_exists($file))
{