diff options
author | Andrey Andreev <narf@devilix.net> | 2018-01-13 12:57:11 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2018-01-13 12:57:11 +0100 |
commit | 02a0518e1c56ba3506f370362ac5ebdb8a138312 (patch) | |
tree | 8b4684192b403dcae17d298eb4fc9e7ab001acad /tests/codeigniter/libraries/Parser_test.php | |
parent | f0b9735d5857e6c07c8f5824b13cff4828db3cfe (diff) |
[ci skip] 3.1.7 release
Diffstat (limited to 'tests/codeigniter/libraries/Parser_test.php')
-rw-r--r-- | tests/codeigniter/libraries/Parser_test.php | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/tests/codeigniter/libraries/Parser_test.php b/tests/codeigniter/libraries/Parser_test.php deleted file mode 100644 index 2a2348793..000000000 --- a/tests/codeigniter/libraries/Parser_test.php +++ /dev/null @@ -1,95 +0,0 @@ -<?php - -class Parser_test extends CI_TestCase { - - public function set_up() - { - $this->parser = new CI_Parser(); - $this->ci_instance_var('parser', $this->parser); - } - - // -------------------------------------------------------------------- - - public function test_set_delimiters() - { - // Make sure default delimiters are there - $this->assertEquals('{', $this->parser->l_delim); - $this->assertEquals('}', $this->parser->r_delim); - - // Change them to square brackets - $this->parser->set_delimiters('[', ']'); - - // Make sure they changed - $this->assertEquals('[', $this->parser->l_delim); - $this->assertEquals(']', $this->parser->r_delim); - - // Reset them - $this->parser->set_delimiters(); - - // Make sure default delimiters are there - $this->assertEquals('{', $this->parser->l_delim); - $this->assertEquals('}', $this->parser->r_delim); - } - - // -------------------------------------------------------------------- - - public function test_parse_string() - { - $data = array( - 'title' => 'Page Title', - 'body' => 'Lorem ipsum dolor sit amet.' - ); - - $template = "{title}\n{body}"; - - $result = implode("\n", $data); - - $this->assertEquals($result, $this->parser->parse_string($template, $data, TRUE)); - } - - // -------------------------------------------------------------------- - - public function test_parse() - { - $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( - 'title' => 'Super Heroes', - 'powers' => array(array('invisibility' => 'yes', 'flying' => 'no')) - ); - - $template = "{title}\n{powers}{invisibility}\n{flying}{/powers}\nsecond:{powers} {invisibility} {flying}{/powers}"; - - $this->assertEquals("Super Heroes\nyes\nno\nsecond: yes no", $this->parser->parse_string($template, $data, TRUE)); - } - - // -------------------------------------------------------------------- - - private function _mismatched_var_pair() - { - $data = array( - 'title' => 'Super Heroes', - 'powers' => array(array('invisibility' => 'yes', 'flying' => 'no')) - ); - - $template = "{title}\n{powers}{invisibility}\n{flying}"; - $result = "Super Heroes\n{powers}{invisibility}\n{flying}"; - - $this->assertEquals($result, $this->parser->parse_string($template, $data, TRUE)); - } - -}
\ No newline at end of file |