diff options
author | Greg Aker <greg.aker@ellislab.com> | 2011-04-21 21:34:31 +0200 |
---|---|---|
committer | Greg Aker <greg.aker@ellislab.com> | 2011-04-21 21:34:31 +0200 |
commit | b567947d38a20960aade96f9179ad6bc21f22646 (patch) | |
tree | 94b66cbc47c7b9f1a9477cdc2733ce58ebfcc302 | |
parent | 56106630e172203858d58325dea5d2e81b226f87 (diff) |
Moving tests/codeigniter/helpers/Array_helper_test.php to be lower cased.
Adding html_helper_test.php as well.
-rw-r--r-- | tests/Bootstrap.php | 8 | ||||
-rw-r--r-- | tests/codeigniter/helpers/array_helper_test.php (renamed from tests/codeigniter/helpers/Array_helper_test.php) | 0 | ||||
-rw-r--r-- | tests/codeigniter/helpers/html_helper_test.php | 67 | ||||
-rw-r--r-- | tests/phpunit.xml | 5 |
4 files changed, 78 insertions, 2 deletions
diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 94dafdce4..db5ffbd52 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -17,4 +17,12 @@ define('APPPATH', PROJECT_BASE.'application/'); require_once $dir.'/lib/common.php'; require_once $dir.'/lib/ci_testcase.php'; + +// Omit files in the PEAR & PHP Paths from ending up in the coverage report +PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(PEAR_INSTALL_DIR); +PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(PHP_LIBDIR); + +// Omit Tests from the coverage reports. +// PHP_CodeCoverage_Filter::getInstance() + unset($dir);
\ No newline at end of file diff --git a/tests/codeigniter/helpers/Array_helper_test.php b/tests/codeigniter/helpers/array_helper_test.php index bbefdb49d..bbefdb49d 100644 --- a/tests/codeigniter/helpers/Array_helper_test.php +++ b/tests/codeigniter/helpers/array_helper_test.php diff --git a/tests/codeigniter/helpers/html_helper_test.php b/tests/codeigniter/helpers/html_helper_test.php new file mode 100644 index 000000000..3b7f2b342 --- /dev/null +++ b/tests/codeigniter/helpers/html_helper_test.php @@ -0,0 +1,67 @@ +<?php + +require_once(BASEPATH.'helpers/html_helper.php'); + +class Html_helper_test extends PHPUnit_Framework_TestCase +{ + public function testHeading() + { + $this->assertEquals('<h1>foobar</h1>', heading('foobar')); + } + + // ------------------------------------------------------------------------ + + public function testUl() + { + $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 testNBS() + { + $this->assertEquals(' ', nbs(3)); + } + + // ------------------------------------------------------------------------ + + public function testMeta() + { + $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 diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 9e5e10d59..1e712a1bb 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -1,17 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit - bootstrap="Bootstrap.php" + bootstrap="./Bootstrap.php" colors="true"> <testsuites> <testsuite name="CodeIgniter Core Test Suite"> <file>codeigniter/Setup_test.php</file> <directory suffix="test.php">codeigniter/core</directory> - + <directory suffix="test.php">codeigniter/helpers</directory> <!-- We'll worry about these later ... <directory suffix="test.php">codeigniter/libraries</directory> <directory suffix="test.php">codeigniter/helpers</directory> --> + </testsuite> </testsuites> </phpunit>
\ No newline at end of file |