summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGreg Aker <greg.aker@ellislab.com>2011-04-21 21:54:59 +0200
committerGreg Aker <greg.aker@ellislab.com>2011-04-21 21:54:59 +0200
commita7f9b251b03f7fb17251951d3024cb11fc1f881f (patch)
treea4d685de7cc8353dcf736da4343cfff6abc443f6 /tests
parentb4d93dbab7253f98613ab10e75e0ed20f06eaf19 (diff)
Parser test.
Diffstat (limited to 'tests')
-rw-r--r--tests/codeigniter/libraries/Parser_test.php42
-rw-r--r--tests/phpunit.xml1
2 files changed, 17 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
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
index 1e712a1bb..e07aa96a7 100644
--- a/tests/phpunit.xml
+++ b/tests/phpunit.xml
@@ -8,6 +8,7 @@
<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>