Greg Aker avatar Greg Aker committed 8f9243f

Parser test.

Comments (0)

Files changed (2)

tests/codeigniter/libraries/Parser_test.php

 
 // OLD TEST FORMAT: DO NOT COPY
 
-class Parser_test extends PHPUnit_Framework_TestCase
+require BASEPATH.'libraries/Parser.php';
+
+class Parser_test extends CI_TestCase
 {
-	static $cls;
-	protected $parser;
-	
-	public static function setUpBeforeClass()
-	{
-		$CI = get_instance();
-		$CI->load->library('parser');
-		self::$cls = get_class($CI->parser);
-	}
-
-	// --------------------------------------------------------------------
 	
 	public function setUp()
 	{
-		$cls = self::$cls;
-		$this->parser = new $cls;
+		$obj = new StdClass;
+		$obj->parser = new CI_Parser();
+		
+		$this->ci_instance($obj);
+		
+		$this->parser = $obj->parser;
 	}
 	// --------------------------------------------------------------------
 	
 	}
 	
 	// --------------------------------------------------------------------
-
+	
 	public function testParse()
 	{
 		$this->_parse_no_template();
 		$this->_parse_var_pair();
 		$this->_mismatched_var_pair();
 	}
-
+	
 	// --------------------------------------------------------------------
-
+	
 	private function _parse_no_template()
 	{
 		$this->assertFalse($this->parser->parse_string('', '', TRUE));
 	}
-
+	
 	// --------------------------------------------------------------------
-
+	
 	private function _parse_var_pair()
 	{
 		$data = array(
 		
 		$this->assertEquals($result, $this->parser->parse_string($template, $data, TRUE));	
 	}
-
+	
 	// --------------------------------------------------------------------
-
+	
 	private function _mismatched_var_pair()
 	{
 		$data = array(
 	}
 
 	// --------------------------------------------------------------------
-
-	// --------------------------------------------------------------------
-
-	// --------------------------------------------------------------------
-
 }

tests/phpunit.xml

 			<file>codeigniter/Setup_test.php</file>
 			<directory suffix="test.php">codeigniter/core</directory>
 			<directory suffix="test.php">codeigniter/helpers</directory>
+			<directory suffix="test.php">codeigniter/libraries</directory>
 			<!-- We'll worry about these later ...
 			<directory suffix="test.php">codeigniter/libraries</directory>
 			<directory suffix="test.php">codeigniter/helpers</directory>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.