Commits

Greg Aker committed bad9e77

Buttoning up model loader tests.

Comments (0)

Files changed (1)

tests/codeigniter/core/Loader_test.php

 		$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);
 		
 		
 		$this->assertNull($this->load->model('unit_test_model'));
 		
+		// Was the model class instantiated.
+		$this->assertTrue(class_exists('Unit_test_model'));
+		
 		// Test no model given
-		$this->assertFalse($this->load->model(''));
-		
-		// Test a string given to params
-		// $this->assertEquals(NULL, $this->load->model('foobar', ' '));		
+		$this->assertNull($this->load->model(''));	
 	}
 
 	// --------------------------------------------------------------------
 	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');
+		
 	}
 
 	// --------------------------------------------------------------------
 
 	// --------------------------------------------------------------------
 	
-	// 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')));
 	}