blob: b5384eaef59090e0339ee427f1d3c6a006145d9f [file] [log] [blame]
Greg Aker2c4b3662011-08-21 16:28:06 -05001<?php
2
3require_once(BASEPATH.'helpers/url_helper.php');
4
5class Url_helper_test extends CI_TestCase
6{
7 public function test_url_title()
8 {
9 $words = array(
10 'foo bar /' => 'foo-bar',
11 '\ testing 12' => 'testing-12'
12 );
Eric Barnes94076142011-11-27 00:59:07 -050013
Greg Aker2c4b3662011-08-21 16:28:06 -050014 foreach ($words as $in => $out)
15 {
16 $this->assertEquals($out, url_title($in, 'dash', TRUE));
Eric Barnes94076142011-11-27 00:59:07 -050017 }
Greg Aker2c4b3662011-08-21 16:28:06 -050018 }
19
20 // --------------------------------------------------------------------
21
Eric Barnes94076142011-11-27 00:59:07 -050022 public function test_url_title_extra_dashes()
23 {
24 $words = array(
25 '_foo bar_' => 'foo_bar',
26 '_What\'s wrong with CSS?_' => 'Whats_wrong_with_CSS'
27 );
28
29 foreach ($words as $in => $out)
30 {
31 $this->assertEquals($out, url_title($in, 'underscore'));
32 }
33 }
Greg Aker2c4b3662011-08-21 16:28:06 -050034}