diff options
author | Greg Aker <greg.aker@ellislab.com> | 2011-04-21 21:54:59 +0200 |
---|---|---|
committer | Greg Aker <greg.aker@ellislab.com> | 2011-04-21 21:54:59 +0200 |
commit | a7f9b251b03f7fb17251951d3024cb11fc1f881f (patch) | |
tree | a4d685de7cc8353dcf736da4343cfff6abc443f6 /tests/codeigniter | |
parent | b4d93dbab7253f98613ab10e75e0ed20f06eaf19 (diff) |
Parser test.
Diffstat (limited to 'tests/codeigniter')
-rw-r--r-- | tests/codeigniter/libraries/Parser_test.php | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/tests/codeigniter/libraries/Parser_test.php b/tests/codeigniter/libraries/Parser_test.php index a8de108f0..3f63bd589 100644 --- a/tests/codeigniter/libraries/Parser_test.php +++ b/tests/codeigniter/libraries/Parser_test.php @@ -2,24 +2,19 @@ // OLD TEST FORMAT: DO NOT COPY -class Parser_test extends PHPUnit_Framework_TestCase -{ - static $cls; - protected $parser; - - public static function setUpBeforeClass() - { - $CI = get_instance(); - $CI->load->library('parser'); - self::$cls = get_class($CI->parser); - } +require BASEPATH.'libraries/Parser.php'; - // -------------------------------------------------------------------- +class Parser_test extends CI_TestCase +{ 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; } // -------------------------------------------------------------------- @@ -61,23 +56,23 @@ class Parser_test extends PHPUnit_Framework_TestCase } // -------------------------------------------------------------------- - + 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( @@ -95,9 +90,9 @@ class Parser_test extends PHPUnit_Framework_TestCase $this->assertEquals($result, $this->parser->parse_string($template, $data, TRUE)); } - + // -------------------------------------------------------------------- - + private function _mismatched_var_pair() { $data = array( @@ -117,9 +112,4 @@ class Parser_test extends PHPUnit_Framework_TestCase } // -------------------------------------------------------------------- - - // -------------------------------------------------------------------- - - // -------------------------------------------------------------------- - }
\ No newline at end of file |