From 2c4b36620828173f3caf83fc7f6146bccb3688f4 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Sun, 21 Aug 2011 16:28:06 -0500 Subject: Adding url_helper unit test file. GO! --- tests/codeigniter/helpers/url_helper_test.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/codeigniter/helpers/url_helper_test.php (limited to 'tests/codeigniter/helpers/url_helper_test.php') diff --git a/tests/codeigniter/helpers/url_helper_test.php b/tests/codeigniter/helpers/url_helper_test.php new file mode 100644 index 000000000..ea3fb0e4f --- /dev/null +++ b/tests/codeigniter/helpers/url_helper_test.php @@ -0,0 +1,22 @@ + 'foo-bar', + '\ testing 12' => 'testing-12' + ); + + foreach ($words as $in => $out) + { + $this->assertEquals($out, url_title($in, 'dash', TRUE)); + } + } + + // -------------------------------------------------------------------- + +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 940761464e6f7788bdce0bad55f41850ad73eb89 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sun, 27 Nov 2011 00:59:07 -0500 Subject: Added tests for removing extra dashes in url title. --- tests/codeigniter/helpers/url_helper_test.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'tests/codeigniter/helpers/url_helper_test.php') diff --git a/tests/codeigniter/helpers/url_helper_test.php b/tests/codeigniter/helpers/url_helper_test.php index ea3fb0e4f..b5384eaef 100644 --- a/tests/codeigniter/helpers/url_helper_test.php +++ b/tests/codeigniter/helpers/url_helper_test.php @@ -10,13 +10,25 @@ class Url_helper_test extends CI_TestCase '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')); + } + } } \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 32b6780d6e75a39e62784cec998ee2b5f69ee77e Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sun, 27 Nov 2011 01:10:09 -0500 Subject: Added prep_url and auto_link tests --- tests/codeigniter/helpers/url_helper_test.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/codeigniter/helpers/url_helper_test.php') diff --git a/tests/codeigniter/helpers/url_helper_test.php b/tests/codeigniter/helpers/url_helper_test.php index b5384eaef..30ba4a417 100644 --- a/tests/codeigniter/helpers/url_helper_test.php +++ b/tests/codeigniter/helpers/url_helper_test.php @@ -31,4 +31,27 @@ class Url_helper_test extends CI_TestCase $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' => 'http://www.codeigniter.com test', + 'This is my noreply@codeigniter.com test' => 'This is my noreply@codeigniter.com test', + ); + + foreach ($strings as $in => $out) + { + $this->assertEquals($out, auto_link($in, 'url')); + } + } } \ No newline at end of file -- cgit v1.2.3-24-g4f1b From d90e1a0fb541ee94459a20cf8b0726aebaec9692 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sun, 27 Nov 2011 14:12:46 -0500 Subject: Added unit test to confirm pull request #675 --- tests/codeigniter/helpers/url_helper_test.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/codeigniter/helpers/url_helper_test.php') diff --git a/tests/codeigniter/helpers/url_helper_test.php b/tests/codeigniter/helpers/url_helper_test.php index 30ba4a417..51a8cc7c0 100644 --- a/tests/codeigniter/helpers/url_helper_test.php +++ b/tests/codeigniter/helpers/url_helper_test.php @@ -47,6 +47,21 @@ class Url_helper_test extends CI_TestCase $strings = array( 'www.codeigniter.com test' => 'http://www.codeigniter.com test', 'This is my noreply@codeigniter.com test' => 'This is my noreply@codeigniter.com test', + '
www.google.com' => '
http://www.google.com', + ); + + foreach ($strings as $in => $out) + { + $this->assertEquals($out, auto_link($in, 'url')); + } + } + + // -------------------------------------------------------------------- + + public function test_pull_675() + { + $strings = array( + '
www.google.com' => '
http://www.google.com', ); foreach ($strings as $in => $out) -- cgit v1.2.3-24-g4f1b