diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-03-20 21:08:57 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-03-20 21:08:57 +0100 |
commit | 6f9d923baa43e2ef60bafdd263730aa4f5f103e7 (patch) | |
tree | 068fbd93ac1027544437b0241902565821d5dab2 /tests/codeigniter/helpers/url_helper_test.php | |
parent | 0a529c2be1f9f888f481afa989bd7d3db615c85f (diff) | |
parent | 8480f7c35af9aacaf2ebee43677ff1d31a5cce13 (diff) |
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop-db-sqlite3
Diffstat (limited to 'tests/codeigniter/helpers/url_helper_test.php')
-rw-r--r-- | tests/codeigniter/helpers/url_helper_test.php | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/codeigniter/helpers/url_helper_test.php b/tests/codeigniter/helpers/url_helper_test.php new file mode 100644 index 000000000..51a8cc7c0 --- /dev/null +++ b/tests/codeigniter/helpers/url_helper_test.php @@ -0,0 +1,72 @@ +<?php + +require_once(BASEPATH.'helpers/url_helper.php'); + +class Url_helper_test extends CI_TestCase +{ + public function test_url_title() + { + $words = array( + 'foo bar /' => 'foo-bar', + '\ testing 12' => 'testing-12' + ); + + foreach ($words as $in => $out) + { + $this->assertEquals($out, url_title($in, 'dash', TRUE)); + } + } + + // -------------------------------------------------------------------- + + public function test_url_title_extra_dashes() + { + $words = array( + '_foo bar_' => 'foo_bar', + '_What\'s wrong with CSS?_' => 'Whats_wrong_with_CSS' + ); + + foreach ($words as $in => $out) + { + $this->assertEquals($out, url_title($in, 'underscore')); + } + } + + // -------------------------------------------------------------------- + + public function test_prep_url() + { + $this->assertEquals('http://codeigniter.com', prep_url('codeigniter.com')); + $this->assertEquals('http://www.codeigniter.com', prep_url('www.codeigniter.com')); + } + + // -------------------------------------------------------------------- + + public function test_auto_link_url() + { + $strings = array( + 'www.codeigniter.com test' => '<a href="http://www.codeigniter.com">http://www.codeigniter.com</a> test', + 'This is my noreply@codeigniter.com test' => 'This is my noreply@codeigniter.com test', + '<br />www.google.com' => '<br /><a href="http://www.google.com">http://www.google.com</a>', + ); + + foreach ($strings as $in => $out) + { + $this->assertEquals($out, auto_link($in, 'url')); + } + } + + // -------------------------------------------------------------------- + + public function test_pull_675() + { + $strings = array( + '<br />www.google.com' => '<br /><a href="http://www.google.com">http://www.google.com</a>', + ); + + foreach ($strings as $in => $out) + { + $this->assertEquals($out, auto_link($in, 'url')); + } + } +}
\ No newline at end of file |