summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter
diff options
context:
space:
mode:
authorGreg Aker <greg.aker@ellislab.com>2011-04-21 18:44:11 +0200
committerGreg Aker <greg.aker@ellislab.com>2011-04-21 18:44:11 +0200
commitdeab6ad864f05367e2c122906f63d24286b731d1 (patch)
treeb56833212300245ee077a347fadacfb9cca4f1b5 /tests/codeigniter
parent98357c5865dbec43bcb79fb114469d40cf2f5367 (diff)
Buttoning up model loader tests.
Diffstat (limited to 'tests/codeigniter')
-rw-r--r--tests/codeigniter/core/Loader_test.php39
1 files changed, 20 insertions, 19 deletions
diff --git a/tests/codeigniter/core/Loader_test.php b/tests/codeigniter/core/Loader_test.php
index 83ee68777..d84928eca 100644
--- a/tests/codeigniter/core/Loader_test.php
+++ b/tests/codeigniter/core/Loader_test.php
@@ -64,7 +64,7 @@ class Loader_test extends CI_TestCase {
$this->ci_instance_var('config', $config);
// Test loading as an array.
- $this->assertEquals(NULL, $this->load->library(array('table')));
+ $this->assertNull($this->load->library(array('table')));
$this->assertTrue(class_exists('CI_Table'), 'Table class exists');
$this->assertAttributeInstanceOf('CI_Table', 'table', $this->ci_obj);
@@ -100,11 +100,11 @@ class Loader_test extends CI_TestCase {
$this->assertNull($this->load->model('unit_test_model'));
- // Test no model given
- $this->assertFalse($this->load->model(''));
+ // Was the model class instantiated.
+ $this->assertTrue(class_exists('Unit_test_model'));
- // Test a string given to params
- // $this->assertEquals(NULL, $this->load->model('foobar', ' '));
+ // Test no model given
+ $this->assertNull($this->load->model(''));
}
// --------------------------------------------------------------------
@@ -132,14 +132,8 @@ class Loader_test extends CI_TestCase {
public function testFile()
{
// I'm not entirely sure this is the proper way to handle this.
- try
- {
- $this->load->file('foo');
- }
- catch (Exception $expected)
- {
- return;
- }
+ // $this->load->file('foo');
+
}
// --------------------------------------------------------------------
@@ -156,15 +150,22 @@ class Loader_test extends CI_TestCase {
// --------------------------------------------------------------------
- // public function testHelper()
- // {
- // $this->assertEquals(NULL, $this->load->helper('array'));
- // $this->assertEquals(NULL, $this->load->helper('bad'));
- // }
+ public function testHelper()
+ {
+ $this->assertEquals(NULL, $this->load->helper('array'));
+
+ $this->setExpectedException(
+ 'Exception',
+ 'CI Error: Unable to load the requested file: helpers/bad_helper.php'
+ );
+
+
+ $this->load->helper('bad');
+ }
// --------------------------------------------------------------------
- public function testHelpers()
+ public function testLoadingMultipleHelpers()
{
$this->assertEquals(NULL, $this->load->helpers(array('file', 'array', 'string')));
}