summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/codeigniter/core/Input_test.php8
-rw-r--r--tests/codeigniter/core/Lang_test.php9
-rw-r--r--tests/codeigniter/database/query_builder/insert_test.php8
-rw-r--r--tests/mocks/autoloader.php14
-rw-r--r--tests/mocks/core/common.php2
-rw-r--r--tests/mocks/database/drivers/sqlite.php2
-rw-r--r--tests/phpunit.xml25
7 files changed, 47 insertions, 21 deletions
diff --git a/tests/codeigniter/core/Input_test.php b/tests/codeigniter/core/Input_test.php
index a066d9960..cfc80c950 100644
--- a/tests/codeigniter/core/Input_test.php
+++ b/tests/codeigniter/core/Input_test.php
@@ -29,8 +29,8 @@ class Input_test extends CI_TestCase {
$this->assertTrue( ! $this->input->get('foo'));
// Test we're getting empty results
- $this->assertTrue($this->input->get() == NULL);
- $this->assertTrue($this->input->get('foo') == NULL);
+ $this->assertTrue($this->input->get() === NULL);
+ $this->assertTrue($this->input->get('foo') === NULL);
// Test new 3.0 behaviour for non existant results (used to be FALSE)
$this->assertTrue($this->input->get() === NULL);
@@ -70,8 +70,8 @@ class Input_test extends CI_TestCase {
$this->assertTrue( ! $this->input->post());
$this->assertTrue( ! $this->input->post('foo'));
- $this->assertTrue($this->input->post() == NULL);
- $this->assertTrue($this->input->post('foo') == NULL);
+ $this->assertTrue($this->input->post() === NULL);
+ $this->assertTrue($this->input->post('foo') === NULL);
$this->assertTrue($this->input->post() === NULL);
$this->assertTrue($this->input->post('foo') === NULL);
diff --git a/tests/codeigniter/core/Lang_test.php b/tests/codeigniter/core/Lang_test.php
index a414f0ace..874230feb 100644
--- a/tests/codeigniter/core/Lang_test.php
+++ b/tests/codeigniter/core/Lang_test.php
@@ -18,13 +18,14 @@ class Lang_test extends CI_TestCase {
public function test_load()
{
$this->assertTrue($this->lang->load('profiler', 'english'));
+ $this->assertEquals('URI STRING', $this->lang->line('profiler_uri_string'));
}
-
- // --------------------------------------------------------------------
- public function test_line()
+ // --------------------------------------------------------------------
+
+ public function test_load_with_unspecified_language()
{
- $this->assertTrue($this->lang->load('profiler', 'english'));
+ $this->assertTrue($this->lang->load('profiler'));
$this->assertEquals('URI STRING', $this->lang->line('profiler_uri_string'));
}
diff --git a/tests/codeigniter/database/query_builder/insert_test.php b/tests/codeigniter/database/query_builder/insert_test.php
index 8ba60e242..a9aafb66e 100644
--- a/tests/codeigniter/database/query_builder/insert_test.php
+++ b/tests/codeigniter/database/query_builder/insert_test.php
@@ -26,7 +26,7 @@ class Insert_test extends CI_TestCase {
public function test_insert()
{
$job_data = array('id' => 1, 'name' => 'Grocery Sales', 'description' => 'Discount!');
-
+
// Do normal insert
$this->assertTrue($this->db->insert('job', $job_data));
@@ -45,10 +45,10 @@ class Insert_test extends CI_TestCase {
public function test_insert_batch()
{
$job_datas = array(
- array('id' => 2, 'name' => 'Commedian', 'description' => 'Theres something in your teeth'),
+ array('id' => 2, 'name' => 'Commedian', 'description' => 'Theres something in your teeth'),
array('id' => 3, 'name' => 'Cab Driver', 'description' => 'Iam yellow'),
);
-
+
// Do insert batch except for sqlite driver
if (strpos(DB_DRIVER, 'sqlite') === FALSE)
{
@@ -62,5 +62,5 @@ class Insert_test extends CI_TestCase {
$this->assertEquals('Cab Driver', $job_3->name);
}
}
-
+
} \ No newline at end of file
diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php
index 441c88944..90aabcbe6 100644
--- a/tests/mocks/autoloader.php
+++ b/tests/mocks/autoloader.php
@@ -7,9 +7,9 @@
// Prototype :
//
// $mock_table = new Mock_Libraries_Table(); // Will load ./mocks/libraries/table.php
-// $mock_database_driver = new Mock_Database_Driver(); // Will load ./mocks/database/driver.php
+// $mock_database_driver = new Mock_Database_Driver(); // Will load ./mocks/database/driver.php
// and so on...
-function autoload($class)
+function autoload($class)
{
$dir = realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR;
@@ -50,9 +50,9 @@ function autoload($class)
elseif (in_array($subclass, $ci_libraries))
{
$dir = BASEPATH.'libraries'.DIRECTORY_SEPARATOR;
- $class = ($subclass == 'Driver_Library') ? 'Driver' : $subclass;
+ $class = ($subclass === 'Driver_Library') ? 'Driver' : $subclass;
}
- elseif (preg_match('/^CI_DB_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) == 3)
+ elseif (preg_match('/^CI_DB_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 3)
{
$driver_path = BASEPATH.'database'.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR;
$dir = $driver_path.$m[1].DIRECTORY_SEPARATOR;
@@ -75,13 +75,13 @@ function autoload($class)
{
$trace = debug_backtrace();
- // If the autoload call came from `class_exists` or `file_exists`,
+ // If the autoload call came from `class_exists` or `file_exists`,
// we skipped and return FALSE
- if ($trace[2]['function'] == 'class_exists' OR $trace[2]['function'] == 'file_exists')
+ if ($trace[2]['function'] === 'class_exists' OR $trace[2]['function'] === 'file_exists')
{
return FALSE;
}
-
+
throw new InvalidArgumentException("Unable to load $class.");
}
diff --git a/tests/mocks/core/common.php b/tests/mocks/core/common.php
index e74576626..e1c493aa0 100644
--- a/tests/mocks/core/common.php
+++ b/tests/mocks/core/common.php
@@ -45,7 +45,7 @@ if ( ! function_exists('load_class'))
{
function load_class($class, $directory = 'libraries', $prefix = 'CI_')
{
- if ($directory != 'core' OR $prefix != 'CI_')
+ if ($directory !== 'core' OR $prefix !== 'CI_')
{
throw new Exception('Not Implemented: Non-core load_class()');
}
diff --git a/tests/mocks/database/drivers/sqlite.php b/tests/mocks/database/drivers/sqlite.php
index 76a182cbf..15cefbf53 100644
--- a/tests/mocks/database/drivers/sqlite.php
+++ b/tests/mocks/database/drivers/sqlite.php
@@ -1,7 +1,7 @@
<?php
class Mock_Database_Drivers_Sqlite extends Mock_Database_DB_Driver {
-
+
/**
* Instantiate the database driver
*
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
new file mode 100644
index 000000000..56cb8841c
--- /dev/null
+++ b/tests/phpunit.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<phpunit
+ bootstrap="./Bootstrap.php"
+ colors="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ stopOnError="false"
+ stopOnFailure="false"
+ stopOnIncomplete="false"
+ stopOnSkipped="false">
+ <testsuites>
+ <testsuite name="CodeIgniter Core Test Suite">
+ <directory suffix="test.php">./codeigniter/core</directory>
+ <directory suffix="test.php">./codeigniter/helpers</directory>
+ <directory suffix="test.php">./codeigniter/libraries</directory>
+ </testsuite>
+ </testsuites>
+ <filters>
+ <blacklist>
+ <directory suffix=".php">PEAR_INSTALL_DIR</directory>
+ <directory suffix=".php">PHP_LIBDIR</directory>
+ </blacklist>
+ </filters>
+</phpunit> \ No newline at end of file