diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-03-14 11:46:34 +0100 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-03-14 11:46:34 +0100 |
commit | 0fe8c8e21315e00dbc06a87290fb268a2dc999a9 (patch) | |
tree | 4bc75acb95f49de7bf5df9ec3eb684bc39c93ad0 /tests/codeigniter/helpers/html_helper_test.php | |
parent | ca6404749a8dd3ee5dd68d64832374dce05fe6a3 (diff) | |
parent | 62c0647d241d556590d470ea27ac9aa36f609bfa (diff) |
Merge branch 'feature/unit-tests' into develop
Diffstat (limited to 'tests/codeigniter/helpers/html_helper_test.php')
-rw-r--r-- | tests/codeigniter/helpers/html_helper_test.php | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/tests/codeigniter/helpers/html_helper_test.php b/tests/codeigniter/helpers/html_helper_test.php new file mode 100644 index 000000000..553fc2bb1 --- /dev/null +++ b/tests/codeigniter/helpers/html_helper_test.php @@ -0,0 +1,78 @@ +<?php + +require_once(BASEPATH.'helpers/html_helper.php'); + +class Html_helper_test extends CI_TestCase +{ + + // ------------------------------------------------------------------------ + + public function test_br() + { + $this->assertEquals('<br /><br />', br(2)); + } + + // ------------------------------------------------------------------------ + + public function test_heading() + { + $this->assertEquals('<h1>foobar</h1>', heading('foobar')); + $this->assertEquals('<h2 class="bar">foobar</h2>', heading('foobar', 2, 'class="bar"')); + } + + // ------------------------------------------------------------------------ + + public function test_Ul() + { + $expect = <<<EOH +<ul> + <li>foo</li> + <li>bar</li> +</ul> + +EOH; + + $expect = ltrim($expect); + + $list = array('foo', 'bar'); + + $this->assertEquals($expect, ul($list)); + + + $expect = <<<EOH +<ul class="test"> + <li>foo</li> + <li>bar</li> +</ul> + +EOH; + + $expect = ltrim($expect); + + $list = array('foo', 'bar'); + + $this->assertEquals($expect, ul($list, 'class="test"')); + + $this->assertEquals($expect, ul($list, array('class' => 'test'))); + } + + // ------------------------------------------------------------------------ + + public function test_NBS() + { + $this->assertEquals(' ', nbs(3)); + } + + // ------------------------------------------------------------------------ + + public function test_meta() + { + $this->assertEquals("<meta name=\"test\" content=\"foo\" />\n", meta('test', 'foo')); + + $expect = "<meta name=\"foo\" content=\"\" />\n"; + + $this->assertEquals($expect, meta(array('name' => 'foo'))); + + } + +}
\ No newline at end of file |