diff options
author | Andrey Andreev <narf@devilix.net> | 2019-01-16 16:49:35 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2019-01-16 16:49:35 +0100 |
commit | c576995304fc3609cca0b7b92d1b2cd611ec82f5 (patch) | |
tree | c8b9121cb295b56bbabe3aeaad0a3eb1f2d390bb /tests/codeigniter/helpers | |
parent | 4eaf80a6ec0b58a0adc95638153363e00ebf5378 (diff) |
[ci skip] 3.1.10 release
Diffstat (limited to 'tests/codeigniter/helpers')
19 files changed, 0 insertions, 1770 deletions
diff --git a/tests/codeigniter/helpers/array_helper_test.php b/tests/codeigniter/helpers/array_helper_test.php deleted file mode 100644 index b2409c330..000000000 --- a/tests/codeigniter/helpers/array_helper_test.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -class Array_helper_test extends CI_TestCase { - - public $my_array = array( - 'foo' => 'bar', - 'sally' => 'jim', - 'maggie' => 'bessie', - 'herb' => 'cook' - ); - - public function set_up() - { - $this->helper('array'); - } - - // ------------------------------------------------------------------------ - - public function test_element_with_existing_item() - { - $this->assertEquals(FALSE, element('testing', $this->my_array)); - $this->assertEquals('not set', element('testing', $this->my_array, 'not set')); - $this->assertEquals('bar', element('foo', $this->my_array)); - } - - // ------------------------------------------------------------------------ - - public function test_random_element() - { - // Send a string, not an array to random_element - $this->assertEquals('my string', random_element('my string')); - - // Test sending an array - $this->assertContains(random_element($this->my_array), $this->my_array); - } - - // ------------------------------------------------------------------------ - - public function test_elements() - { - $this->assertInternalType('array', elements('test', $this->my_array)); - $this->assertInternalType('array', elements('foo', $this->my_array)); - } - -} diff --git a/tests/codeigniter/helpers/captcha_helper_test.php b/tests/codeigniter/helpers/captcha_helper_test.php deleted file mode 100644 index bb8760a15..000000000 --- a/tests/codeigniter/helpers/captcha_helper_test.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -class Captcha_helper_test extends CI_TestCase { - - public function test_create_captcha() - { - $this->markTestSkipped("Can't test"); - } - -}
\ No newline at end of file diff --git a/tests/codeigniter/helpers/cookie_helper_test.php b/tests/codeigniter/helpers/cookie_helper_test.php deleted file mode 100644 index fba68f20f..000000000 --- a/tests/codeigniter/helpers/cookie_helper_test.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -class Cookie_helper_test extends CI_TestCase { - - public function set_up() - { - $this->helper('cookie'); - } - - // ------------------------------------------------------------------------ - - function test_set_cookie() - { - /*$input_cls = $this->ci_core_class('input'); - $this->ci_instance_var('input', new $input_cls); - - $this->assertTrue(set_cookie( - 'my_cookie', - 'foobar' - ));*/ - - $this->markTestSkipped('Need to find a way to overcome a headers already set exception'); - } - - // ------------------------------------------------------------------------ - - function test_get_cookie() - { - $_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->assertEquals('bar', get_cookie('foo', FALSE)); - $this->assertEquals('bar', get_cookie('foo', TRUE)); - - $_COOKIE['bar'] = "Hello, i try to <script>alert('Hack');</script> your site"; - - $this->assertEquals("Hello, i try to [removed]alert('Hack');[removed] your site", get_cookie('bar', TRUE)); - $this->assertEquals("Hello, i try to <script>alert('Hack');</script> your site", get_cookie('bar', FALSE)); - } - - // ------------------------------------------------------------------------ - - function test_delete_cookie() - { - /*$input_cls = $this->ci_core_class('input'); - $this->ci_instance_var('input', new $input_cls); - - $this->assertTrue(delete_cookie( - 'my_cookie' - ));*/ - - $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/date_helper_test.php b/tests/codeigniter/helpers/date_helper_test.php deleted file mode 100644 index b419418bf..000000000 --- a/tests/codeigniter/helpers/date_helper_test.php +++ /dev/null @@ -1,325 +0,0 @@ -<?php - -class Date_helper_test extends CI_TestCase { - - public function set_up() - { - $this->helper('date'); - $this->time = time(); - } - - // ------------------------------------------------------------------------ - - public function test_nice_date() - { - $this->assertEquals('2016-11-01', nice_date('201611', 'Y-m-d')); - $this->assertEquals('2016-11-23', nice_date('20161123', 'Y-m-d')); - } - - // ------------------------------------------------------------------------ - - public function test_now_local() - { - /* - - // This stub job, is simply to cater $config['time_reference'] - $config = $this->getMockBuilder('CI_Config')->getMock(); - $config->expects($this->any()) - ->method('item') - ->will($this->returnValue('local')); - - // Add the stub to our test instance - $this->ci_instance_var('config', $config); - - */ - - $this->ci_set_config('time_reference', 'local'); - - $this->assertEquals(time(), now()); - } - - // ------------------------------------------------------------------------ - - public function test_now_utc() - { - /* - - // This stub job, is simply to cater $config['time_reference'] - $config = $this->getMockBuilder('CI_Config')->getMock(); - $config->expects($this->any()) - ->method('item') - ->will($this->returnValue('UTC')); - - // Add the stub to our stdClass - $this->ci_instance_var('config', $config); - - */ - - $this->assertEquals( - mktime(gmdate('G'), gmdate('i'), gmdate('s'), gmdate('n'), gmdate('j'), gmdate('Y')), - now('UTC') - ); - } - - // ------------------------------------------------------------------------ - - public function test_mdate() - { - $this->assertEquals( - date('Y-m-d - h:i a', $this->time), - mdate('%Y-%m-%d - %h:%i %a', $this->time) - ); - } - - // ------------------------------------------------------------------------ - - public function test_standard_date_rfc822() - { - $this->assertEquals( - date(DATE_RFC822, $this->time), - standard_date('DATE_RFC822', $this->time) - ); - } - - // ------------------------------------------------------------------------ - - public function test_standard_date_atom() - { - $this->assertEquals( - date(DATE_ATOM, $this->time), - standard_date('DATE_ATOM', $this->time) - ); - } - - // ------------------------------------------------------------------------ - - public function test_standard_date_cookie() - { - $this->assertEquals( - date(DATE_COOKIE, $this->time), - standard_date('DATE_COOKIE', $this->time) - ); - } - - // ------------------------------------------------------------------------ - - public function test_standard_date_iso8601() - { - $this->assertEquals( - date(DATE_ISO8601, $this->time), - standard_date('DATE_ISO8601', $this->time) - ); - } - - // ------------------------------------------------------------------------ - - public function test_standard_date_rfc850() - { - $this->assertEquals( - date(DATE_RFC850, $this->time), - standard_date('DATE_RFC850', $this->time) - ); - } - - // ------------------------------------------------------------------------ - - public function test_standard_date_rfc1036() - { - $this->assertEquals( - date(DATE_RFC1036, $this->time), - standard_date('DATE_RFC1036', $this->time) - ); - } - - // ------------------------------------------------------------------------ - - public function test_standard_date_rfc1123() - { - $this->assertEquals( - date(DATE_RFC1123, $this->time), - standard_date('DATE_RFC1123', $this->time) - ); - } - - // ------------------------------------------------------------------------ - - public function test_standard_date_rfc2822() - { - $this->assertEquals( - date(DATE_RFC2822, $this->time), - standard_date('DATE_RFC2822', $this->time) - ); - } - - // ------------------------------------------------------------------------ - - public function test_standard_date_rss() - { - $this->assertEquals( - date(DATE_RSS, $this->time), - standard_date('DATE_RSS', $this->time) - ); - } - - // ------------------------------------------------------------------------ - - public function test_standard_date_w3c() - { - $this->assertEquals( - date(DATE_W3C, $this->time), - standard_date('DATE_W3C', $this->time) - ); - } - - // ------------------------------------------------------------------------ - - public function test_timespan() - { - $this->ci_vfs_clone('system/language/english/date_lang.php'); - - $loader_cls = $this->ci_core_class('load'); - $this->ci_instance_var('load', new $loader_cls); - - $lang_cls = $this->ci_core_class('lang'); - $this->ci_instance_var('lang', new $lang_cls); - - $this->assertEquals('1 Second', timespan(time(), time()+1)); - $this->assertEquals('1 Minute', timespan(time(), time()+60)); - $this->assertEquals('1 Hour', timespan(time(), time()+3600)); - $this->assertEquals('2 Hours', timespan(time(), time()+7200)); - } - - // ------------------------------------------------------------------------ - - public function test_days_in_month() - { - $this->assertEquals(30, days_in_month(06, 2005)); - $this->assertEquals(28, days_in_month(02, 2011)); - $this->assertEquals(29, days_in_month(02, 2012)); - } - - // ------------------------------------------------------------------------ - - public function test_local_to_gmt() - { - $this->assertEquals( - mktime( - gmdate('G', $this->time), gmdate('i', $this->time), gmdate('s', $this->time), - gmdate('n', $this->time), gmdate('j', $this->time), gmdate('Y', $this->time) - ), - local_to_gmt($this->time) - ); - } - - // ------------------------------------------------------------------------ - - public function test_gmt_to_local() - { - $this->assertEquals(1140128493, gmt_to_local('1140153693', 'UM8', TRUE)); - } - - // ------------------------------------------------------------------------ - - public function test_mysql_to_unix() - { - $this->assertEquals($this->time, mysql_to_unix(date('Y-m-d H:i:s', $this->time))); - } - - // ------------------------------------------------------------------------ - - public function test_unix_to_human() - { - $this->assertEquals(date('Y-m-d h:i A', $this->time), unix_to_human($this->time)); - $this->assertEquals(date('Y-m-d h:i:s A', $this->time), unix_to_human($this->time, TRUE, 'us')); - $this->assertEquals(date('Y-m-d H:i:s', $this->time), unix_to_human($this->time, TRUE, 'eu')); - } - - // ------------------------------------------------------------------------ - - public function test_human_to_unix() - { - $date = '2000-12-31 10:00:00 PM'; - $this->assertEquals(strtotime($date), human_to_unix($date)); - $this->assertFalse(human_to_unix()); - } - - // ------------------------------------------------------------------------ - - public function test_timezones() - { - $zones = array( - 'UM12' => -12, - 'UM11' => -11, - 'UM10' => -10, - 'UM95' => -9.5, - 'UM9' => -9, - 'UM8' => -8, - 'UM7' => -7, - 'UM6' => -6, - 'UM5' => -5, - 'UM45' => -4.5, - 'UM4' => -4, - 'UM35' => -3.5, - 'UM3' => -3, - 'UM2' => -2, - 'UM1' => -1, - 'UTC' => 0, - 'UP1' => +1, - 'UP2' => +2, - 'UP3' => +3, - 'UP35' => +3.5, - 'UP4' => +4, - 'UP45' => +4.5, - 'UP5' => +5, - 'UP55' => +5.5, - 'UP575' => +5.75, - 'UP6' => +6, - 'UP65' => +6.5, - 'UP7' => +7, - 'UP8' => +8, - 'UP875' => +8.75, - 'UP9' => +9, - 'UP95' => +9.5, - 'UP10' => +10, - 'UP105' => +10.5, - 'UP11' => +11, - 'UP115' => +11.5, - 'UP12' => +12, - 'UP1275' => +12.75, - 'UP13' => +13, - 'UP14' => +14 - ); - - foreach ($zones AS $test => $expected) - { - $this->assertEquals($expected, timezones($test)); - } - - $this->assertArrayHasKey('UP3', timezones()); - $this->assertEquals(0, timezones('non_existent')); - } - - // ------------------------------------------------------------------------ - - public function test_date_range() - { - $dates = array( - '29-01-2012', '30-01-2012', '31-01-2012', - '01-02-2012', '02-02-2012', '03-02-2012', - '04-02-2012', '05-02-2012', '06-02-2012', - '07-02-2012', '08-02-2012', '09-02-2012', - '10-02-2012', '11-02-2012', '12-02-2012', - '13-02-2012', '14-02-2012', '15-02-2012', - '16-02-2012', '17-02-2012', '18-02-2012', - '19-02-2012', '20-02-2012', '21-02-2012', - '22-02-2012', '23-02-2012', '24-02-2012', - '25-02-2012', '26-02-2012', '27-02-2012', - '28-02-2012', '29-02-2012', '01-03-2012' - ); - - $this->assertEquals($dates, date_range(mktime(12, 0, 0, 1, 29, 2012), mktime(12, 0, 0, 3, 1, 2012), TRUE, 'd-m-Y')); - array_pop($dates); - $this->assertEquals($dates, date_range(mktime(12, 0, 0, 1, 29, 2012), 31, FALSE, 'd-m-Y')); - } - -} diff --git a/tests/codeigniter/helpers/directory_helper_test.php b/tests/codeigniter/helpers/directory_helper_test.php deleted file mode 100644 index 253c1e368..000000000 --- a/tests/codeigniter/helpers/directory_helper_test.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -class Directory_helper_test extends CI_TestCase { - - public function set_up() - { - $this->helper('directory'); - - vfsStreamWrapper::register(); - vfsStreamWrapper::setRoot(new vfsStreamDirectory('testDir')); - - $this->_test_dir = vfsStreamWrapper::getRoot(); - } - - public function test_directory_map() - { - $ds = DIRECTORY_SEPARATOR; - - $structure = array( - 'libraries' => array( - 'benchmark.html' => '', - 'database' => array('active_record.html' => '', 'binds.html' => ''), - 'email.html' => '', - '0' => '', - '.hiddenfile.txt' => '' - ) - ); - - vfsStream::create($structure, $this->_test_dir); - - // is_dir(), opendir(), etc. seem to fail on Windows + vfsStream when there are trailing backslashes in directory names - if ( ! is_dir(vfsStream::url('testDir').DIRECTORY_SEPARATOR)) - { - $this->markTestSkipped("Can't test this under Windows"); - return; - } - - // test default recursive behavior - $expected = array( - 'libraries'.$ds => array( - 'benchmark.html', - 'database'.$ds => array('active_record.html', 'binds.html'), - 'email.html', - '0' - ) - ); - - $this->assertEquals($expected, directory_map(vfsStream::url('testDir'))); - - // test detection of hidden files - $expected['libraries'.$ds][] = '.hiddenfile.txt'; - - $this->assertEquals($expected, directory_map(vfsStream::url('testDir'), 0, TRUE)); - - // test recursion depth behavior - $this->assertEquals(array('libraries'.$ds), directory_map(vfsStream::url('testDir'), 1)); - } - -} diff --git a/tests/codeigniter/helpers/download_helper_test.php b/tests/codeigniter/helpers/download_helper_test.php deleted file mode 100644 index d2b42e46b..000000000 --- a/tests/codeigniter/helpers/download_helper_test.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -class Download_helper_test extends CI_TestCase { - - public function test_force_download() - { - $this->markTestSkipped('Cant easily test'); - } - -}
\ No newline at end of file diff --git a/tests/codeigniter/helpers/email_helper_test.php b/tests/codeigniter/helpers/email_helper_test.php deleted file mode 100644 index 529e96910..000000000 --- a/tests/codeigniter/helpers/email_helper_test.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -class Email_helper_test extends CI_TestCase { - - public function set_up() - { - $this->helper('email'); - } - - public function test_valid_email() - { - $this->assertEquals(FALSE, valid_email('test')); - $this->assertEquals(FALSE, valid_email('test@test@test.com')); - $this->assertEquals(TRUE, valid_email('test@test.com')); - $this->assertEquals(TRUE, valid_email('my.test@test.com')); - $this->assertEquals(TRUE, valid_email('my.test@subdomain.test.com')); - } - - public function test_send_mail() - { - $this->markTestSkipped("Can't test"); - } - -}
\ No newline at end of file diff --git a/tests/codeigniter/helpers/file_helper_test.php b/tests/codeigniter/helpers/file_helper_test.php deleted file mode 100644 index c31817595..000000000 --- a/tests/codeigniter/helpers/file_helper_test.php +++ /dev/null @@ -1,147 +0,0 @@ -<?php - -class File_helper_Test extends CI_TestCase { - - public function set_up() - { - $this->helper('file'); - - vfsStreamWrapper::register(); - vfsStreamWrapper::setRoot(new vfsStreamDirectory('testDir')); - - $this->_test_dir = vfsStreamWrapper::getRoot(); - } - - // -------------------------------------------------------------------- - - public function test_read_file() - { - $this->assertFalse(read_file('does_not_exist')); - - $content = 'Jack and Jill went up the mountain to fight a billy goat.'; - - $file = vfsStream::newFile('my_file.txt')->withContent($content)->at($this->_test_dir); - - $this->assertEquals($content, read_file(vfsStream::url('my_file.txt'))); - } - - // -------------------------------------------------------------------- - - public function test_octal_permissions() - { - $content = 'Jack and Jill went up the mountain to fight a billy goat.'; - - $file = vfsStream::newFile('my_file.txt', 0777) - ->withContent($content) - ->lastModified(time() - 86400) - ->at($this->_test_dir); - - $this->assertEquals('777', octal_permissions($file->getPermissions())); - } - - // -------------------------------------------------------------------- - - /** - * More tests should happen here, since I'm not hitting the whole function. - */ - public function test_symbolic_permissions() - { - $content = 'Jack and Jill went up the mountain to fight a billy goat.'; - - $file = vfsStream::newFile('my_file.txt', 0777) - ->withContent($content) - ->lastModified(time() - 86400) - ->at($this->_test_dir); - - $this->assertEquals('urwxrwxrwx', symbolic_permissions($file->getPermissions())); - } - - // -------------------------------------------------------------------- - - public function test_get_mime_by_extension() - { - $content = 'Jack and Jill went up the mountain to fight a billy goat.'; - - $file = vfsStream::newFile('my_file.txt', 0777) - ->withContent($content) - ->lastModified(time() - 86400) - ->at($this->_test_dir); - - $this->assertEquals('text/plain', get_mime_by_extension(vfsStream::url('my_file.txt'))); - - // Test a mime with an array, such as png - $file = vfsStream::newFile('foo.png')->at($this->_test_dir); - - $this->assertEquals('image/png', get_mime_by_extension(vfsStream::url('foo.png'))); - - // Test a file not in the mimes array - $file = vfsStream::newFile('foo.blarfengar')->at($this->_test_dir); - - $this->assertFalse(get_mime_by_extension(vfsStream::url('foo.blarfengar'))); - } - - // -------------------------------------------------------------------- - - public function test_get_file_info() - { - // Test Bad File - $this->assertFalse(get_file_info('i_am_bad_boo')); - - // Test the rest - - // First pass in an array - $vals = array( - 'name', 'server_path', 'size', 'date', - 'readable', 'writable', 'executable', 'fileperms' - ); - - $this->_test_get_file_info($vals); - - // Test passing in vals as a string. - $this->_test_get_file_info(implode(', ', $vals)); - } - - private function _test_get_file_info($vals) - { - $content = 'Jack and Jill went up the mountain to fight a billy goat.'; - $last_modified = time() - 86400; - - $file = vfsStream::newFile('my_file.txt', 0777) - ->withContent($content) - ->lastModified($last_modified) - ->at($this->_test_dir); - - $ret_values = array( - 'name' => 'my_file.txt', - 'server_path' => 'vfs://my_file.txt', - 'size' => 57, - 'date' => $last_modified, - 'readable' => TRUE, - 'writable' => TRUE, - 'executable' => TRUE, - 'fileperms' => 33279 - ); - - $info = get_file_info(vfsStream::url('my_file.txt'), $vals); - - foreach ($info as $k => $v) - { - $this->assertEquals($ret_values[$k], $v); - } - } - - // -------------------------------------------------------------------- - - public function test_write_file() - { - $content = 'Jack and Jill went up the mountain to fight a billy goat.'; - - $file = vfsStream::newFile('write.txt', 0777) - ->withContent('') - ->lastModified(time() - 86400) - ->at($this->_test_dir); - - $this->assertTrue(write_file(vfsStream::url('write.txt'), $content)); - } - -}
\ No newline at end of file diff --git a/tests/codeigniter/helpers/form_helper_test.php b/tests/codeigniter/helpers/form_helper_test.php deleted file mode 100644 index b5fe99b96..000000000 --- a/tests/codeigniter/helpers/form_helper_test.php +++ /dev/null @@ -1,290 +0,0 @@ -<?php - -class Form_helper_test extends CI_TestCase -{ - public function set_up() - { - $this->helper('form'); - } - - // ------------------------------------------------------------------------ - - public function test_form_hidden() - { - $expected = <<<EOH - -<input type="hidden" name="username" value="johndoe" /> - -EOH; - - $this->assertEquals($expected, form_hidden('username', 'johndoe')); - } - - // ------------------------------------------------------------------------ - - public function test_form_input() - { - $expected = <<<EOH -<input type="text" name="username" value="johndoe" id="username" maxlength="100" size="50" style="width:50%" /> - -EOH; - - $data = array( - 'name' => 'username', - 'id' => 'username', - 'value' => 'johndoe', - 'maxlength' => '100', - 'size' => '50', - 'style' => 'width:50%', - ); - - $this->assertEquals($expected, form_input($data)); - } - - // ------------------------------------------------------------------------ - - public function test_form_password() - { - $expected = <<<EOH -<input type="password" name="password" value="" /> - -EOH; - - $this->assertEquals($expected, form_password('password')); - } - - // ------------------------------------------------------------------------ - - public function test_form_upload() - { - $expected = <<<EOH -<input type="file" name="attachment" /> - -EOH; - - $this->assertEquals($expected, form_upload('attachment')); - } - - // ------------------------------------------------------------------------ - - public function test_form_textarea() - { - $expected = <<<EOH -<textarea name="notes" cols="40" rows="10" >Notes</textarea> - -EOH; - - $this->assertEquals($expected, form_textarea('notes', 'Notes')); - } - - // ------------------------------------------------------------------------ - - public function test_form_dropdown() - { - $expected = <<<EOH -<select name="shirts"> -<option value="small">Small Shirt</option> -<option value="med">Medium Shirt</option> -<option value="large" selected="selected">Large Shirt</option> -<option value="xlarge">Extra Large Shirt</option> -</select> - -EOH; - - $options = array( - 'small' => 'Small Shirt', - 'med' => 'Medium Shirt', - 'large' => 'Large Shirt', - 'xlarge' => 'Extra Large Shirt', - ); - - $this->assertEquals($expected, form_dropdown('shirts', $options, 'large')); - - $expected = <<<EOH -<select name="shirts" multiple="multiple"> -<option value="small" selected="selected">Small Shirt</option> -<option value="med">Medium Shirt</option> -<option value="large" selected="selected">Large Shirt</option> -<option value="xlarge">Extra Large Shirt</option> -</select> - -EOH; - - $shirts_on_sale = array('small', 'large'); - - $this->assertEquals($expected, form_dropdown('shirts', $options, $shirts_on_sale)); - - $options = array( - 'Swedish Cars' => array( - 'volvo' => 'Volvo', - 'saab' => 'Saab' - ), - 'German Cars' => array( - 'mercedes' => 'Mercedes', - 'audi' => 'Audi' - ) - ); - - $expected = <<<EOH -<select name="cars" multiple="multiple"> -<optgroup label="Swedish Cars"> -<option value="volvo" selected="selected">Volvo</option> -<option value="saab">Saab</option> -</optgroup> -<optgroup label="German Cars"> -<option value="mercedes">Mercedes</option> -<option value="audi" selected="selected">Audi</option> -</optgroup> -</select> - -EOH; - - $this->assertEquals($expected, form_dropdown('cars', $options, array('volvo', 'audi'))); - } - - // ------------------------------------------------------------------------ - - public function test_form_multiselect() - { - $expected = <<<EOH -<select name="shirts[]" multiple="multiple"> -<option value="small">Small Shirt</option> -<option value="med" selected="selected">Medium Shirt</option> -<option value="large" selected="selected">Large Shirt</option> -<option value="xlarge">Extra Large Shirt</option> -</select> - -EOH; - - $options = array( - 'small' => 'Small Shirt', - 'med' => 'Medium Shirt', - 'large' => 'Large Shirt', - 'xlarge' => 'Extra Large Shirt', - ); - - $this->assertEquals($expected, form_multiselect('shirts[]', $options, array('med', 'large'))); - } - - // ------------------------------------------------------------------------ - - public function test_form_fieldset() - { - $expected = <<<EOH -<fieldset> -<legend>Address Information</legend> - -EOH; - - $this->assertEquals($expected, form_fieldset('Address Information')); - } - - // ------------------------------------------------------------------------ - - public function test_form_fieldset_close() - { - $expected = <<<EOH -</fieldset></div></div> -EOH; - - $this->assertEquals($expected, form_fieldset_close('</div></div>')); - } - - // ------------------------------------------------------------------------ - - public function test_form_checkbox() - { - $expected = <<<EOH -<input type="checkbox" name="newsletter" value="accept" checked="checked" /> - -EOH; - - $this->assertEquals($expected, form_checkbox('newsletter', 'accept', TRUE)); - } - - // ------------------------------------------------------------------------ - - public function test_form_radio() - { - $expected = <<<EOH -<input type="radio" name="newsletter" value="accept" checked="checked" /> - -EOH; - - $this->assertEquals($expected, form_radio('newsletter', 'accept', TRUE)); - } - - // ------------------------------------------------------------------------ - - public function test_form_submit() - { - $expected = <<<EOH -<input type="submit" name="mysubmit" value="Submit Post!" /> - -EOH; - - $this->assertEquals($expected, form_submit('mysubmit', 'Submit Post!')); - } - - // ------------------------------------------------------------------------ - - public function test_form_label() - { - $expected = <<<EOH -<label for="username">What is your Name</label> -EOH; - - $this->assertEquals($expected, form_label('What is your Name', 'username')); - } - - // ------------------------------------------------------------------------ - - public function test_form_reset() - { - $expected = <<<EOH -<input type="reset" name="myreset" value="Reset" /> - -EOH; - - $this->assertEquals($expected, form_reset('myreset', 'Reset')); - } - - // ------------------------------------------------------------------------ - - public function test_form_button() - { - $expected = <<<EOH -<button name="name" type="button" >content</button> - -EOH; - - $this->assertEquals($expected, form_button('name', 'content')); - } - - // ------------------------------------------------------------------------ - - public function test_form_close() - { - $expected = <<<EOH -</form></div></div> -EOH; - - $this->assertEquals($expected, form_close('</div></div>')); - } - - // ------------------------------------------------------------------------ - - public function test_form_prep() - { - $this->assertEquals( - 'Here is a string containing "quoted" text.', - form_prep('Here is a string containing "quoted" text.') - ); - - $this->assertEquals( - 'Here is a string containing a <tag>.', - form_prep('Here is a string containing a <tag>.', TRUE) - ); - } - -} diff --git a/tests/codeigniter/helpers/html_helper_test.php b/tests/codeigniter/helpers/html_helper_test.php deleted file mode 100644 index 3cf1016ec..000000000 --- a/tests/codeigniter/helpers/html_helper_test.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php - -class Html_helper_test extends CI_TestCase { - - public function set_up() - { - $this->helper('html'); - } - - // ------------------------------------------------------------------------ - - public function test_br() - { - $this->assertEquals('<br /><br />', br(2)); - } - - // ------------------------------------------------------------------------ - - public function test_heading() - { - $this->assertEquals('<h1>foobar</h1>', heading('foobar')); - $this->assertEquals('<h2 class="bar">foobar</h2>', heading('foobar', 2, 'class="bar"')); - } - - public function test_heading_array_attributes() - { - // Test array of attributes - $this->assertEquals('<h2 class="bar" id="foo">foobar</h2>', heading('foobar', 2, array('class' => 'bar', 'id' => 'foo'))); - } - - public function test_heading_object_attributes() - { - // Test array of attributes - $this->assertEquals('<h2 class="bar" id="foo">foobar</h2>', heading('foobar', 2, array('class' => 'bar', 'id' => 'foo'))); - $test = new stdClass; - $test->class = "bar"; - $test->id = "foo"; - $this->assertEquals('<h2 class="bar" id="foo">foobar</h2>', heading('foobar', 2, $test)); - } - - // ------------------------------------------------------------------------ - - public function test_img() - { - $this->ci_set_config('base_url', 'http://localhost/'); - $this->assertEquals('<img src="http://localhost/test" alt="" />', img("test")); - $this->assertEquals('<img src="data:foo/bar,baz" alt="" />', img("data:foo/bar,baz")); - $this->assertEquals('<img src="http://localhost/data://foo" alt="" />', img("data://foo")); - $this->assertEquals('<img src="//foo.bar/baz" alt="" />', img("//foo.bar/baz")); - $this->assertEquals('<img src="http://foo.bar/baz" alt="" />', img("http://foo.bar/baz")); - $this->assertEquals('<img src="https://foo.bar/baz" alt="" />', img("https://foo.bar/baz")); - $this->assertEquals('<img src="ftp://foo.bar/baz" alt="" />', img("ftp://foo.bar/baz")); - } - - // ------------------------------------------------------------------------ - - public function test_Ul() - { - $expect = <<<EOH -<ul> - <li>foo</li> - <li>bar</li> -</ul> - -EOH; - - $expect = ltrim($expect); - $list = array('foo', 'bar'); - - $this->assertEquals(ltrim($expect), ul($list)); - - $expect = <<<EOH -<ul class="test"> - <li>foo</li> - <li>bar</li> -</ul> - -EOH; - - $expect = ltrim($expect); - - $this->assertEquals($expect, ul($list, 'class="test"')); - - $this->assertEquals($expect, ul($list, array('class' => 'test'))); - } - - // ------------------------------------------------------------------------ - - public function test_NBS() - { - $this->assertEquals(' ', nbs(3)); - } - - // ------------------------------------------------------------------------ - - public function test_meta() - { - $this->assertEquals("<meta name=\"test\" content=\"foo\" />\n", meta('test', 'foo')); - - $expect = "<meta name=\"foo\" content=\"\" />\n"; - - $this->assertEquals($expect, meta(array('name' => 'foo'))); - - } - -} diff --git a/tests/codeigniter/helpers/inflector_helper_test.php b/tests/codeigniter/helpers/inflector_helper_test.php deleted file mode 100644 index 3ec681bcd..000000000 --- a/tests/codeigniter/helpers/inflector_helper_test.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php - -class Inflector_helper_test extends CI_TestCase { - - public function set_up() - { - $this->helper('inflector'); - } - - public function test_singular() - { - $strs = array( - 'tellies' => 'telly', - 'smellies' => 'smelly', - 'abjectnesses' => 'abjectness', - 'smells' => 'smell', - 'equipment' => 'equipment' - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, singular($str)); - } - } - - // -------------------------------------------------------------------- - - public function test_plural() - { - $strs = array( - 'telly' => 'tellies', - 'smelly' => 'smellies', - 'abjectness' => 'abjectnesses', // ref : http://en.wiktionary.org/wiki/abjectnesses - 'smell' => 'smells', - 'witch' => 'witches', - 'equipment' => 'equipment' - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, plural($str)); - } - } - - // -------------------------------------------------------------------- - - public function test_camelize() - { - $strs = array( - 'this is the string' => 'thisIsTheString', - 'this is another one' => 'thisIsAnotherOne', - 'i-am-playing-a-trick' => 'i-am-playing-a-trick', - 'what_do_you_think-yo?' => 'whatDoYouThink-yo?', - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, camelize($str)); - } - } - - // -------------------------------------------------------------------- - - public function test_underscore() - { - $strs = array( - 'this is the string' => 'this_is_the_string', - 'this is another one' => 'this_is_another_one', - 'i-am-playing-a-trick' => 'i-am-playing-a-trick', - 'what_do_you_think-yo?' => 'what_do_you_think-yo?', - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, underscore($str)); - } - } - - // -------------------------------------------------------------------- - - public function test_humanize() - { - $strs = array( - 'this_is_the_string' => 'This Is The String', - 'this_is_another_one' => 'This Is Another One', - 'i-am-playing-a-trick' => 'I-am-playing-a-trick', - 'what_do_you_think-yo?' => 'What Do You Think-yo?', - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, humanize($str)); - } - } - -} diff --git a/tests/codeigniter/helpers/language_helper_test.php b/tests/codeigniter/helpers/language_helper_test.php deleted file mode 100644 index 1ddabea3d..000000000 --- a/tests/codeigniter/helpers/language_helper_test.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -class Language_helper_test extends CI_TestCase { - - public function test_lang() - { - $this->helper('language'); - $lang = $this->getMockBuilder('CI_Lang')->setMethods(array('line'))->getMock(); - $lang->expects($this->any())->method('line')->will($this->returnValue(FALSE)); - $this->ci_instance_var('lang', $lang); - - $this->assertFalse(lang(1)); - $this->assertEquals('<label for="foo" class="bar"></label>', lang(1, 'foo', array('class' => 'bar'))); - } - -} diff --git a/tests/codeigniter/helpers/number_helper_test.php b/tests/codeigniter/helpers/number_helper_test.php deleted file mode 100644 index 663e354fe..000000000 --- a/tests/codeigniter/helpers/number_helper_test.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -class Number_helper_test extends CI_TestCase { - - public function set_up() - { - $this->helper('number'); - - // Grab the core lang class - $lang_cls = $this->ci_core_class('lang'); - - // Mock away load, too much going on in there, - // we'll just check for the expected parameter - $lang = $this->getMockBuilder('CI_Lang')->setMethods(array('load'))->getMock(); - $lang->expects($this->once()) - ->method('load') - ->with($this->equalTo('number')); - - // Assign the proper language array - $lang->language = $this->lang('number'); - - // We don't have a controller, so just create - // a cheap class to act as our super object. - // Make sure it has a lang attribute. - $this->ci_instance_var('lang', $lang); - } - - public function test_byte_format() - { - $this->assertEquals('456 Bytes', byte_format(456)); - } - - public function test_kb_format() - { - $this->assertEquals('4.5 KB', byte_format(4567)); - } - - public function test_kb_format_medium() - { - $this->assertEquals('44.6 KB', byte_format(45678)); - } - - public function test_kb_format_large() - { - $this->assertEquals('446.1 KB', byte_format(456789)); - } - - public function test_mb_format() - { - $this->assertEquals('3.3 MB', byte_format(3456789)); - } - - public function test_gb_format() - { - $this->assertEquals('1.8 GB', byte_format(1932735283.2)); - } - - public function test_tb_format() - { - $this->assertEquals('112,283.3 TB', byte_format(123456789123456789)); - } - -} diff --git a/tests/codeigniter/helpers/path_helper_test.php b/tests/codeigniter/helpers/path_helper_test.php deleted file mode 100644 index 9d325e70d..000000000 --- a/tests/codeigniter/helpers/path_helper_test.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -class Path_helper_test extends CI_TestCase { - - public function set_up() - { - $this->helper('path'); - } - - public function test_set_realpath() - { - $this->assertEquals(getcwd().DIRECTORY_SEPARATOR, set_realpath(getcwd())); - } - - public function test_set_realpath_nonexistent_directory() - { - $expected = '/path/to/nowhere'; - $this->assertEquals($expected, set_realpath('/path/to/nowhere', FALSE)); - } - - public function test_set_realpath_error_trigger() - { - $this->setExpectedException( - 'RuntimeException', 'CI Error: Not a valid path: /path/to/nowhere' - ); - - set_realpath('/path/to/nowhere', TRUE); - } - -} diff --git a/tests/codeigniter/helpers/security_helper_test.php b/tests/codeigniter/helpers/security_helper_test.php deleted file mode 100644 index effd3ec02..000000000 --- a/tests/codeigniter/helpers/security_helper_test.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -class Security_helper_tests extends CI_TestCase { - - function setUp() - { - $this->helper('security'); - $obj = new stdClass; - $obj->security = new Mock_Core_Security(); - $this->ci_instance($obj); - } - - function test_xss_clean() - { - $this->assertEquals('foo', xss_clean('foo')); - - $this->assertEquals("Hello, i try to [removed]alert('Hack');[removed] your site", xss_clean("Hello, i try to <script>alert('Hack');</script> your site")); - } - - function test_sanitize_filename() - { - $this->assertEquals('hello.doc', sanitize_filename('hello.doc')); - - $filename = './<!--foo-->'; - $this->assertEquals('foo', sanitize_filename($filename)); - } - - function test_do_hash() - { - $md5 = md5('foo'); - $sha1 = sha1('foo'); - - $algos = hash_algos(); - $algo_results = array(); - foreach ($algos as $k => $v) - { - $algo_results[$v] = hash($v, 'foo'); - } - - $this->assertEquals($sha1, do_hash('foo')); - $this->assertEquals($sha1, do_hash('foo', 'sha1')); - $this->assertEquals($md5, do_hash('foo', 'md5')); - $this->assertEquals($md5, do_hash('foo', 'foobar')); - - // Test each algorithm available to PHP - foreach ($algo_results as $algo => $result) - { - $this->assertEquals($result, do_hash('foo', $algo)); - } - } - - function test_strip_image_tags() - { - $this->assertEquals('http://example.com/spacer.gif', strip_image_tags('http://example.com/spacer.gif')); - - $this->assertEquals('http://example.com/spacer.gif', strip_image_tags('<img src="http://example.com/spacer.gif" alt="Who needs CSS when you have a spacer.gif?" />')); - } - - function test_encode_php_tags() - { - $this->assertEquals('<? echo $foo; ?>', encode_php_tags('<? echo $foo; ?>')); - } - -}
\ No newline at end of file diff --git a/tests/codeigniter/helpers/string_helper_test.php b/tests/codeigniter/helpers/string_helper_test.php deleted file mode 100644 index 75701ec13..000000000 --- a/tests/codeigniter/helpers/string_helper_test.php +++ /dev/null @@ -1,148 +0,0 @@ -<?php - -class String_helper_test extends CI_TestCase { - - public function set_up() - { - $this->helper('string'); - } - - public function test_strip_slashes() - { - $expected = array( - "Is your name O'reilly?", - "No, my name is O'connor." - ); - - $str = array( - "Is your name O\'reilly?", - "No, my name is O\'connor." - ); - - $this->assertEquals($expected, strip_slashes($str)); - } - - public function test_trim_slashes() - { - $strs = array( - '//Slashes//\/' => 'Slashes//\\', - '/var/www/html/' => 'var/www/html' - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, trim_slashes($str)); - } - } - - // -------------------------------------------------------------------- - - public function test_strip_quotes() - { - $strs = array( - '"me oh my!"' => 'me oh my!', - "it's a winner!" => 'its a winner!', - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, strip_quotes($str)); - } - } - - // -------------------------------------------------------------------- - - public function test_quotes_to_entities() - { - $strs = array( - '"me oh my!"' => '"me oh my!"', - "it's a winner!" => 'it's a winner!', - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, quotes_to_entities($str)); - } - } - - // -------------------------------------------------------------------- - - public function test_reduce_double_slashes() - { - $strs = array( - 'http://codeigniter.com' => 'http://codeigniter.com', - '//var/www/html/example.com/' => '/var/www/html/example.com/', - '/var/www/html//index.php' => '/var/www/html/index.php' - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, reduce_double_slashes($str)); - } - } - - // -------------------------------------------------------------------- - - public function test_reduce_multiples() - { - $strs = array( - 'Fred, Bill,, Joe, Jimmy' => 'Fred, Bill, Joe, Jimmy', - 'Ringo, John, Paul,,' => 'Ringo, John, Paul,' - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, reduce_multiples($str)); - } - - $strs = array( - 'Fred, Bill,, Joe, Jimmy' => 'Fred, Bill, Joe, Jimmy', - 'Ringo, John, Paul,,' => 'Ringo, John, Paul' - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, reduce_multiples($str, ',', TRUE)); - } - } - - // -------------------------------------------------------------------- - - public function test_repeater() - { - $strs = array( - 'a' => 'aaaaaaaaaa', - ' ' => ' ', - '<br>' => '<br><br><br><br><br><br><br><br><br><br>' - - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, repeater($str, 10)); - } - } - - // -------------------------------------------------------------------- - - public function test_random_string() - { - $this->assertEquals(16, strlen(random_string('alnum', 16))); - $this->assertEquals(32, strlen(random_string('unique', 16))); - $this->assertInternalType('string', random_string('numeric', 16)); - } - - // -------------------------------------------------------------------- - - public function test_increment_string() - { - $this->assertEquals('my-test_1', increment_string('my-test')); - $this->assertEquals('my-test-1', increment_string('my-test', '-')); - $this->assertEquals('file_5', increment_string('file_4')); - $this->assertEquals('file-5', increment_string('file-4', '-')); - $this->assertEquals('file-5', increment_string('file-4', '-')); - $this->assertEquals('file-1', increment_string('file', '-', '1')); - $this->assertEquals(124, increment_string('123', '')); - } - -}
\ No newline at end of file diff --git a/tests/codeigniter/helpers/text_helper_test.php b/tests/codeigniter/helpers/text_helper_test.php deleted file mode 100644 index 7a7dc0a12..000000000 --- a/tests/codeigniter/helpers/text_helper_test.php +++ /dev/null @@ -1,174 +0,0 @@ -<?php - -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, '…')); - $this->assertEquals('', word_limiter('', 4)); - } - - // ------------------------------------------------------------------------ - - 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, '…')); - $this->assertEquals('Short', character_limiter('Short', 20)); - $this->assertEquals('Short', character_limiter('Short', 5)); - } - - // ------------------------------------------------------------------------ - - public function test_ascii_to_entities() - { - $strs = array( - '“‘ “test”' => '“‘ “test”', - '†¥¨ˆøåß∂ƒ©˙∆˚¬' => '†¥¨ˆøåß∂ƒ©˙∆˚¬' - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, ascii_to_entities($str)); - } - } - - // ------------------------------------------------------------------------ - - public function test_entities_to_ascii() - { - $strs = array( - '“‘ “test”' => '“‘ “test”', - '†¥¨ˆøåß∂ƒ©˙∆˚¬' => '†¥¨ˆøåß∂ƒ©˙∆˚¬' - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, entities_to_ascii($str)); - } - } - - // ------------------------------------------------------------------------ - - public function test_convert_accented_characters() - { - $this->ci_vfs_clone('application/config/foreign_chars.php'); - $this->assertEquals('AAAeEEEIIOOEUUUeY', convert_accented_characters('ÀÂÄÈÊËÎÏÔŒÙÛÜŸ')); - $this->assertEquals('a e i o u n ue', convert_accented_characters('á é í ó ú ñ ü')); - } - - // ------------------------------------------------------------------------ - - public function test_censored_words() - { - $censored = array('boob', 'nerd', 'ass', 'fart'); - - $strs = array( - 'Ted bobbled the ball' => 'Ted bobbled the ball', - 'Jake is a nerdo' => 'Jake is a nerdo', - 'The borg will assimilate you' => 'The borg will assimilate you', - 'Did Mary Fart?' => 'Did Mary $*#?', - 'Jake is really a boob' => 'Jake is really a $*#' - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, word_censor($str, $censored, '$*#')); - } - - // test censored words being sent as a string - $this->assertEquals('test', word_censor('test', 'test')); - } - - // ------------------------------------------------------------------------ - - public function test_highlight_code() - { - $expect = "<code><span style=\"color: #000000\">\n<span style=\"color: #0000BB\"><?php var_dump</span><span style=\"color: #007700\">(</span><span style=\"color: #0000BB\">\$this</span><span style=\"color: #007700\">); </span><span style=\"color: #0000BB\">?> </span>\n</span>\n</code>"; - - $this->assertEquals($expect, highlight_code('<?php var_dump($this); ?>')); - } - - // ------------------------------------------------------------------------ - - public function test_highlight_phrase() - { - $strs = array( - 'this is a phrase' => '<mark>this is</mark> a phrase', - 'this is another' => '<mark>this is</mark> another', - 'Gimme a test, Sally' => 'Gimme a test, Sally', - 'Or tell me what this is' => 'Or tell me what <mark>this is</mark>', - '' => '' - ); - - foreach ($strs as $str => $expect) - { - $this->assertEquals($expect, highlight_phrase($str, 'this is')); - } - - $this->assertEquals('<strong>this is</strong> a strong test', highlight_phrase('this is a strong test', 'this is', '<strong>', '</strong>')); - } - - // ------------------------------------------------------------------------ - - public function test_ellipsize() - { - $strs = array( - '0' => array( - 'this is my string' => '… my string', - "here's another one" => '…nother one', - 'this one is just a bit longer' => '…bit longer', - 'short' => 'short' - ), - '.5' => array( - 'this is my string' => 'this …tring', - "here's another one" => "here'…r one", - 'this one is just a bit longer' => 'this …onger', - 'short' => 'short' - ), - '1' => array( - 'this is my string' => 'this is my…', - "here's another one" => "here's ano…", - 'this one is just a bit longer' => 'this one i…', - 'short' => 'short' - ), - ); - - foreach ($strs as $pos => $s) - { - foreach ($s as $str => $expect) - { - $this->assertEquals($expect, ellipsize($str, 10, $pos)); - } - } - } - - // ------------------------------------------------------------------------ - - public function test_word_wrap() - { - $string = 'Here is a simple string of text that will help us demonstrate this function.'; - $this->assertEquals(substr_count(word_wrap($string, 25), "\n"), 4); - } - - // ------------------------------------------------------------------------ - - public function test_default_word_wrap_charlim() - { - $string = "Here is a longer string of text that will help us demonstrate the default charlim of this function."; - $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 deleted file mode 100644 index 83a8c0ec2..000000000 --- a/tests/codeigniter/helpers/url_helper_test.php +++ /dev/null @@ -1,89 +0,0 @@ -<?php - -class Url_helper_test extends CI_TestCase { - - public function set_up() - { - $this->helper('url'); - } - - 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">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">www.google.com</a>', - 'Download CodeIgniter at www.codeigniter.com. Period test.' => 'Download CodeIgniter at <a href="http://www.codeigniter.com">www.codeigniter.com</a>. Period test.', - 'Download CodeIgniter at www.codeigniter.com, comma test' => 'Download CodeIgniter at <a href="http://www.codeigniter.com">www.codeigniter.com</a>, comma test', - 'This one: ://codeigniter.com must not break this one: http://codeigniter.com' => 'This one: <a href="://codeigniter.com">://codeigniter.com</a> must not break this one: <a href="http://codeigniter.com">http://codeigniter.com</a>', - 'Trailing slash: https://codeigniter.com/ fubar' => 'Trailing slash: <a href="https://codeigniter.com/">https://codeigniter.com/</a> fubar' - ); - - 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">www.google.com</a>', - ); - - foreach ($strings as $in => $out) - { - $this->assertEquals($out, auto_link($in, 'url')); - } - } - - // -------------------------------------------------------------------- - - public function test_issue_5331() - { - $this->assertEquals( - 'this is some text that includes '.safe_mailto('www.email@domain.com').' which is causing an issue', - auto_link('this is some text that includes www.email@domain.com which is causing an issue') - ); - } -} diff --git a/tests/codeigniter/helpers/xml_helper_test.php b/tests/codeigniter/helpers/xml_helper_test.php deleted file mode 100644 index e8cf411da..000000000 --- a/tests/codeigniter/helpers/xml_helper_test.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -class Xml_helper_test extends CI_TestCase { - - public function set_up() - { - $this->helper('xml'); - } - - public function test_xml_convert() - { - $this->assertEquals('<tag>my & test - </tag>', xml_convert('<tag>my & test - </tag>')); - } - -}
\ No newline at end of file |