diff options
author | Andrey Andreev <narf@devilix.net> | 2016-12-14 17:14:35 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2016-12-14 17:14:35 +0100 |
commit | dcd6f5153b7e7e6d798d5a77af65b7460f152e5c (patch) | |
tree | 3f52a8b24fe55aeaf29f6cdb6dfa5b6e9f2ac095 /tests/codeigniter/helpers | |
parent | 24c866628d0ce5463d7e8b4eba512fa9e7752dfd (diff) |
Isolate CI_Security instantiation from CI_Input; improve tests
Diffstat (limited to 'tests/codeigniter/helpers')
-rw-r--r-- | tests/codeigniter/helpers/cookie_helper_test.php | 5 | ||||
-rw-r--r-- | tests/codeigniter/helpers/text_helper_test.php | 23 | ||||
-rw-r--r-- | tests/codeigniter/helpers/url_helper_test.php | 12 |
3 files changed, 27 insertions, 13 deletions
diff --git a/tests/codeigniter/helpers/cookie_helper_test.php b/tests/codeigniter/helpers/cookie_helper_test.php index fba68f20f..1fbb57f67 100644 --- a/tests/codeigniter/helpers/cookie_helper_test.php +++ b/tests/codeigniter/helpers/cookie_helper_test.php @@ -29,9 +29,8 @@ class Cookie_helper_test extends CI_TestCase { $_COOKIE['foo'] = 'bar'; $security = new Mock_Core_Security(); - $utf8 = new Mock_Core_Utf8(); $input_cls = $this->ci_core_class('input'); - $this->ci_instance_var('input', new Mock_Core_Input($security, $utf8)); + $this->ci_instance_var('input', new Mock_Core_Input($security)); $this->assertEquals('bar', get_cookie('foo', FALSE)); $this->assertEquals('bar', get_cookie('foo', TRUE)); @@ -56,4 +55,4 @@ class Cookie_helper_test extends CI_TestCase { $this->markTestSkipped('Need to find a way to overcome a headers already set exception'); } -}
\ No newline at end of file +} diff --git a/tests/codeigniter/helpers/text_helper_test.php b/tests/codeigniter/helpers/text_helper_test.php index 7a7dc0a12..36465f203 100644 --- a/tests/codeigniter/helpers/text_helper_test.php +++ b/tests/codeigniter/helpers/text_helper_test.php @@ -2,21 +2,19 @@ class Text_helper_test extends CI_TestCase { - private $_long_string; - public function set_up() { $this->helper('text'); - - $this->_long_string = 'Once upon a time, a framework had no tests. It sad. So some nice people began to write tests. The more time that went on, the happier it became. Everyone was happy.'; } // ------------------------------------------------------------------------ public function test_word_limiter() { - $this->assertEquals('Once upon a time,…', word_limiter($this->_long_string, 4)); - $this->assertEquals('Once upon a time,…', word_limiter($this->_long_string, 4, '…')); + $long_string = 'Once upon a time, a framework had no tests. It sad. So some nice people began to write tests. The more time that went on, the happier it became. Everyone was happy.'; + + $this->assertEquals('Once upon a time,…', word_limiter($long_string, 4)); + $this->assertEquals('Once upon a time,…', word_limiter($long_string, 4, '…')); $this->assertEquals('', word_limiter('', 4)); } @@ -24,8 +22,10 @@ class Text_helper_test extends CI_TestCase { public function test_character_limiter() { - $this->assertEquals('Once upon a time, a…', character_limiter($this->_long_string, 20)); - $this->assertEquals('Once upon a time, a…', character_limiter($this->_long_string, 20, '…')); + $long_string = 'Once upon a time, a framework had no tests. It sad. So some nice people began to write tests. The more time that went on, the happier it became. Everyone was happy.'; + + $this->assertEquals('Once upon a time, a…', character_limiter($long_string, 20)); + $this->assertEquals('Once upon a time, a…', character_limiter($long_string, 20, '…')); $this->assertEquals('Short', character_limiter('Short', 20)); $this->assertEquals('Short', character_limiter('Short', 5)); } @@ -103,8 +103,13 @@ class Text_helper_test extends CI_TestCase { // ------------------------------------------------------------------------ + /** + * @runInSeparateProcess + */ public function test_highlight_phrase() { + define('UTF8_ENABLED', FALSE); + $strs = array( 'this is a phrase' => '<mark>this is</mark> a phrase', 'this is another' => '<mark>this is</mark> another', @@ -171,4 +176,4 @@ class Text_helper_test extends CI_TestCase { $this->assertEquals(strpos(word_wrap($string), "\n"), 73); } -}
\ No newline at end of file +} diff --git a/tests/codeigniter/helpers/url_helper_test.php b/tests/codeigniter/helpers/url_helper_test.php index 24823a634..c5b0f80b7 100644 --- a/tests/codeigniter/helpers/url_helper_test.php +++ b/tests/codeigniter/helpers/url_helper_test.php @@ -7,8 +7,13 @@ class Url_helper_test extends CI_TestCase { $this->helper('url'); } + /** + * @runInSeparateProcess + */ public function test_url_title() { + define('UTF8_ENABLED', FALSE); + $words = array( 'foo bar /' => 'foo-bar', '\ testing 12' => 'testing-12' @@ -22,8 +27,13 @@ class Url_helper_test extends CI_TestCase { // -------------------------------------------------------------------- + /** + * @runInSeparateProcess + */ public function test_url_title_extra_dashes() { + define('UTF8_ENABLED', FALSE); + $words = array( '_foo bar_' => 'foo_bar', '_What\'s wrong with CSS?_' => 'Whats_wrong_with_CSS' @@ -76,4 +86,4 @@ class Url_helper_test extends CI_TestCase { } } -}
\ No newline at end of file +} |