summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/codeigniter/helpers/array_helper_test.php10
-rw-r--r--tests/codeigniter/helpers/date_helper_test.php10
-rw-r--r--tests/codeigniter/helpers/directory_helper_test.php9
-rw-r--r--tests/codeigniter/helpers/email_helper_test.php10
-rw-r--r--tests/codeigniter/helpers/file_helper_test.php7
-rw-r--r--tests/codeigniter/helpers/html_helper_test.php8
-rw-r--r--tests/codeigniter/helpers/inflector_helper_test.php6
-rw-r--r--tests/codeigniter/helpers/number_helper_test.php7
-rw-r--r--tests/codeigniter/helpers/path_helper_test.php9
-rw-r--r--tests/codeigniter/helpers/string_helper_test.php9
-rw-r--r--tests/codeigniter/helpers/text_helper_test.php6
-rw-r--r--tests/codeigniter/helpers/url_helper_test.php9
-rw-r--r--tests/codeigniter/helpers/xml_helper_test.php8
-rw-r--r--tests/mocks/autoloader.php3
-rw-r--r--tests/mocks/ci_testcase.php27
15 files changed, 80 insertions, 58 deletions
diff --git a/tests/codeigniter/helpers/array_helper_test.php b/tests/codeigniter/helpers/array_helper_test.php
index 62559de83..9cd15960f 100644
--- a/tests/codeigniter/helpers/array_helper_test.php
+++ b/tests/codeigniter/helpers/array_helper_test.php
@@ -1,13 +1,11 @@
<?php
-// OLD TEST FORMAT: DO NOT COPY
-
-require_once(BASEPATH.'helpers/array_helper.php');
-
-class Array_helper_test extends CI_TestCase
-{
+class Array_helper_test extends CI_TestCase {
+
public function set_up()
{
+ $this->helper('array');
+
$this->my_array = array(
'foo' => 'bar',
'sally' => 'jim',
diff --git a/tests/codeigniter/helpers/date_helper_test.php b/tests/codeigniter/helpers/date_helper_test.php
index 662d16485..17d1ef21e 100644
--- a/tests/codeigniter/helpers/date_helper_test.php
+++ b/tests/codeigniter/helpers/date_helper_test.php
@@ -1,8 +1,12 @@
<?php
-require_once BASEPATH.'helpers/date_helper.php';
-class Date_helper_test extends CI_TestCase
-{
+class Date_helper_test extends CI_TestCase {
+
+ public function set_up()
+ {
+ $this->helper('date');
+ }
+
// ------------------------------------------------------------------------
public function test_now_local()
diff --git a/tests/codeigniter/helpers/directory_helper_test.php b/tests/codeigniter/helpers/directory_helper_test.php
index 3fae81b82..3937d2913 100644
--- a/tests/codeigniter/helpers/directory_helper_test.php
+++ b/tests/codeigniter/helpers/directory_helper_test.php
@@ -1,12 +1,11 @@
<?php
-require_once 'vfsStream/vfsStream.php';
-require BASEPATH.'helpers/directory_helper.php';
-
-class Directory_helper_test extends CI_TestCase
-{
+class Directory_helper_test extends CI_TestCase {
+
public function set_up()
{
+ $this->helper('directory');
+
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(new vfsStreamDirectory('testDir'));
diff --git a/tests/codeigniter/helpers/email_helper_test.php b/tests/codeigniter/helpers/email_helper_test.php
index 7324e8109..a01f3d5af 100644
--- a/tests/codeigniter/helpers/email_helper_test.php
+++ b/tests/codeigniter/helpers/email_helper_test.php
@@ -1,10 +1,12 @@
<?php
-require_once(BASEPATH.'helpers/email_helper.php');
+class Email_helper_test extends CI_TestCase {
+
+ public function set_up()
+ {
+ $this->helper('email');
+ }
-class Email_helper_test extends CI_TestCase
-{
-
public function test_valid_email()
{
$this->assertEquals(FALSE, valid_email('test'));
diff --git a/tests/codeigniter/helpers/file_helper_test.php b/tests/codeigniter/helpers/file_helper_test.php
index a596a0375..4b9c29485 100644
--- a/tests/codeigniter/helpers/file_helper_test.php
+++ b/tests/codeigniter/helpers/file_helper_test.php
@@ -1,12 +1,11 @@
<?php
-require_once 'vfsStream/vfsStream.php';
-require BASEPATH.'helpers/file_helper.php';
+class File_helper_Test extends CI_TestCase {
-class File_helper_Test extends CI_TestCase
-{
public function set_up()
{
+ $this->helper('file');
+
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(new vfsStreamDirectory('testDir'));
diff --git a/tests/codeigniter/helpers/html_helper_test.php b/tests/codeigniter/helpers/html_helper_test.php
index 553fc2bb1..28974b0f8 100644
--- a/tests/codeigniter/helpers/html_helper_test.php
+++ b/tests/codeigniter/helpers/html_helper_test.php
@@ -1,9 +1,11 @@
<?php
-require_once(BASEPATH.'helpers/html_helper.php');
+class Html_helper_test extends CI_TestCase {
-class Html_helper_test extends CI_TestCase
-{
+ public function set_up()
+ {
+ $this->helper('html');
+ }
// ------------------------------------------------------------------------
diff --git a/tests/codeigniter/helpers/inflector_helper_test.php b/tests/codeigniter/helpers/inflector_helper_test.php
index 472e28adb..9e9478711 100644
--- a/tests/codeigniter/helpers/inflector_helper_test.php
+++ b/tests/codeigniter/helpers/inflector_helper_test.php
@@ -1,9 +1,11 @@
<?php
-require_once(BASEPATH.'helpers/inflector_helper.php');
-
class Inflector_helper_test extends CI_TestCase {
+ public function set_up()
+ {
+ $this->helper('inflector');
+ }
public function test_singular()
{
diff --git a/tests/codeigniter/helpers/number_helper_test.php b/tests/codeigniter/helpers/number_helper_test.php
index 3322b2475..4bb9a918a 100644
--- a/tests/codeigniter/helpers/number_helper_test.php
+++ b/tests/codeigniter/helpers/number_helper_test.php
@@ -1,12 +1,11 @@
<?php
-require_once BASEPATH.'helpers/number_helper.php';
-
-class Number_helper_test extends CI_TestCase
-{
+class Number_helper_test extends CI_TestCase {
public function set_up()
{
+ $this->helper('number');
+
// Grab the core lang class
$lang_cls = $this->ci_core_class('lang');
diff --git a/tests/codeigniter/helpers/path_helper_test.php b/tests/codeigniter/helpers/path_helper_test.php
index 2e6cc6391..632f57501 100644
--- a/tests/codeigniter/helpers/path_helper_test.php
+++ b/tests/codeigniter/helpers/path_helper_test.php
@@ -1,9 +1,12 @@
<?php
-require BASEPATH . 'helpers/path_helper.php';
+class Path_helper_test extends CI_TestCase {
+
+ public function set_up()
+ {
+ $this->helper('path');
+ }
-class Path_helper_test extends CI_TestCase
-{
public function test_set_realpath()
{
$expected = getcwd() . DIRECTORY_SEPARATOR;
diff --git a/tests/codeigniter/helpers/string_helper_test.php b/tests/codeigniter/helpers/string_helper_test.php
index a884d6284..29c3d6594 100644
--- a/tests/codeigniter/helpers/string_helper_test.php
+++ b/tests/codeigniter/helpers/string_helper_test.php
@@ -1,9 +1,12 @@
<?php
-require_once(BASEPATH.'helpers/string_helper.php');
+class String_helper_test extends CI_TestCase {
+
+ public function set_up()
+ {
+ $this->helper('string');
+ }
-class String_helper_test extends CI_TestCase
-{
public function test_strip_slashes()
{
$expected = array(
diff --git a/tests/codeigniter/helpers/text_helper_test.php b/tests/codeigniter/helpers/text_helper_test.php
index a0866e638..584066b0c 100644
--- a/tests/codeigniter/helpers/text_helper_test.php
+++ b/tests/codeigniter/helpers/text_helper_test.php
@@ -1,13 +1,13 @@
<?php
-require_once(BASEPATH.'helpers/text_helper.php');
+class Text_helper_test extends CI_TestCase {
-class Text_helper_test extends CI_TestCase
-{
private $_long_string;
public function set_up()
{
+ $this->helper('text');
+
$this->_long_string = 'Once upon a time, a framework had no tests. It sad. So some nice people began to write tests. The more time that went on, the happier it became. Everyone was happy.';
}
diff --git a/tests/codeigniter/helpers/url_helper_test.php b/tests/codeigniter/helpers/url_helper_test.php
index 51a8cc7c0..c561809ce 100644
--- a/tests/codeigniter/helpers/url_helper_test.php
+++ b/tests/codeigniter/helpers/url_helper_test.php
@@ -1,9 +1,12 @@
<?php
-require_once(BASEPATH.'helpers/url_helper.php');
+class Url_helper_test extends CI_TestCase {
+
+ public function set_up()
+ {
+ $this->helper('url');
+ }
-class Url_helper_test extends CI_TestCase
-{
public function test_url_title()
{
$words = array(
diff --git a/tests/codeigniter/helpers/xml_helper_test.php b/tests/codeigniter/helpers/xml_helper_test.php
index 49f49e166..a83fef91e 100644
--- a/tests/codeigniter/helpers/xml_helper_test.php
+++ b/tests/codeigniter/helpers/xml_helper_test.php
@@ -1,9 +1,11 @@
<?php
-require_once(BASEPATH.'helpers/xml_helper.php');
+class Xml_helper_test extends CI_TestCase {
-class Xml_helper_test extends CI_TestCase
-{
+ public function set_up()
+ {
+ $this->helper('xml');
+ }
public function test_xml_convert()
{
diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php
index 88070e508..bf3fbc508 100644
--- a/tests/mocks/autoloader.php
+++ b/tests/mocks/autoloader.php
@@ -6,8 +6,7 @@
//
// Prototype :
//
-// include_once('Mock_Core_Common') // Will load ./mocks/core/common.php
-// $mock_loader = new Mock_Core_Loader(); // Will load ./mocks/core/loader.php
+// include_once('Mock_Core_Loader') // Will load ./mocks/core/loader.php
// $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
// and so on...
diff --git a/tests/mocks/ci_testcase.php b/tests/mocks/ci_testcase.php
index 5c83974b3..f327e6b07 100644
--- a/tests/mocks/ci_testcase.php
+++ b/tests/mocks/ci_testcase.php
@@ -48,6 +48,13 @@ class CI_TestCase extends PHPUnit_Framework_TestCase {
$this->tear_down();
}
}
+
+ // --------------------------------------------------------------------
+
+ public static function instance()
+ {
+ return self::$ci_test_instance;
+ }
// --------------------------------------------------------------------
@@ -62,6 +69,13 @@ class CI_TestCase extends PHPUnit_Framework_TestCase {
$this->ci_config[$key] = $val;
}
}
+
+ // --------------------------------------------------------------------
+
+ function ci_get_config()
+ {
+ return $this->ci_config;
+ }
// --------------------------------------------------------------------
@@ -153,19 +167,12 @@ class CI_TestCase extends PHPUnit_Framework_TestCase {
self::$ci_test_instance = $this;
parent::runBare();
}
-
- // --------------------------------------------------------------------
-
- public static function instance()
- {
- return self::$ci_test_instance;
- }
-
+
// --------------------------------------------------------------------
- function ci_get_config()
+ function helper($name)
{
- return $this->ci_config;
+ require_once(BASEPATH.'helpers/'.$name.'_helper.php');
}
// --------------------------------------------------------------------