diff options
author | Andrew <browner12@gmail.com> | 2014-02-17 19:24:00 +0100 |
---|---|---|
committer | Andrew <browner12@gmail.com> | 2014-02-17 19:24:00 +0100 |
commit | 63cb46b94c4dda33e036643fbca3d94e0ba079f0 (patch) | |
tree | a8bc36fa23e3a7de491223c896d9aadaf4e8c408 /tests/codeigniter/helpers | |
parent | b6d8b962e44202a74c9b9321a4a53f61a753fccf (diff) | |
parent | ffe8aded4d2210759fce3427ed04893e6c655006 (diff) |
Merge branch 'develop' into patch-1
Diffstat (limited to 'tests/codeigniter/helpers')
-rw-r--r-- | tests/codeigniter/helpers/array_helper_test.php | 16 | ||||
-rw-r--r-- | tests/codeigniter/helpers/captcha_helper_test.php | 2 | ||||
-rw-r--r-- | tests/codeigniter/helpers/directory_helper_test.php | 2 | ||||
-rw-r--r-- | tests/codeigniter/helpers/email_helper_test.php | 5 | ||||
-rw-r--r-- | tests/codeigniter/helpers/file_helper_test.php | 74 | ||||
-rw-r--r-- | tests/codeigniter/helpers/inflector_helper_test.php | 44 |
6 files changed, 71 insertions, 72 deletions
diff --git a/tests/codeigniter/helpers/array_helper_test.php b/tests/codeigniter/helpers/array_helper_test.php index ba46e86f9..5a9958971 100644 --- a/tests/codeigniter/helpers/array_helper_test.php +++ b/tests/codeigniter/helpers/array_helper_test.php @@ -2,16 +2,16 @@ 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'); - - $this->my_array = array( - 'foo' => 'bar', - 'sally' => 'jim', - 'maggie' => 'bessie', - 'herb' => 'cook' - ); } // ------------------------------------------------------------------------ @@ -19,9 +19,7 @@ class Array_helper_test extends CI_TestCase { 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)); } diff --git a/tests/codeigniter/helpers/captcha_helper_test.php b/tests/codeigniter/helpers/captcha_helper_test.php index fc86305e3..bb8760a15 100644 --- a/tests/codeigniter/helpers/captcha_helper_test.php +++ b/tests/codeigniter/helpers/captcha_helper_test.php @@ -4,7 +4,7 @@ class Captcha_helper_test extends CI_TestCase { public function test_create_captcha() { - $this->markTestSkipped('Cant easily test'); + $this->markTestSkipped("Can't test"); } }
\ No newline at end of file diff --git a/tests/codeigniter/helpers/directory_helper_test.php b/tests/codeigniter/helpers/directory_helper_test.php index de72dee78..ac71dfaf8 100644 --- a/tests/codeigniter/helpers/directory_helper_test.php +++ b/tests/codeigniter/helpers/directory_helper_test.php @@ -31,7 +31,7 @@ class Directory_helper_test extends CI_TestCase { // 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(); + $this->markTestSkipped("Can't test this under Windows"); return; } diff --git a/tests/codeigniter/helpers/email_helper_test.php b/tests/codeigniter/helpers/email_helper_test.php index fea452f5f..53a206825 100644 --- a/tests/codeigniter/helpers/email_helper_test.php +++ b/tests/codeigniter/helpers/email_helper_test.php @@ -15,4 +15,9 @@ class Email_helper_test extends CI_TestCase { $this->assertEquals(TRUE, valid_email('my.test@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 index 3a6c73a5c..c31817595 100644 --- a/tests/codeigniter/helpers/file_helper_test.php +++ b/tests/codeigniter/helpers/file_helper_test.php @@ -31,9 +31,10 @@ class File_helper_Test extends CI_TestCase { { $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); + $file = vfsStream::newFile('my_file.txt', 0777) + ->withContent($content) + ->lastModified(time() - 86400) + ->at($this->_test_dir); $this->assertEquals('777', octal_permissions($file->getPermissions())); } @@ -47,9 +48,10 @@ class File_helper_Test extends CI_TestCase { { $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); + $file = vfsStream::newFile('my_file.txt', 0777) + ->withContent($content) + ->lastModified(time() - 86400) + ->at($this->_test_dir); $this->assertEquals('urwxrwxrwx', symbolic_permissions($file->getPermissions())); } @@ -60,9 +62,10 @@ class File_helper_Test extends CI_TestCase { { $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); + $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'))); @@ -103,19 +106,20 @@ class File_helper_Test extends CI_TestCase { $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); + $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 + '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); @@ -128,24 +132,16 @@ class File_helper_Test extends CI_TestCase { // -------------------------------------------------------------------- - // Skipping for now, as it's not implemented in vfsStreamWrapper - // flock(): vfsStreamWrapper::stream_lock is not implemented! - - // public function test_write_file() - // { - // if ( ! defined('FOPEN_WRITE_CREATE_DESTRUCTIVE')) - // { - // define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); - // } - // - // $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)); - // - // } + 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/inflector_helper_test.php b/tests/codeigniter/helpers/inflector_helper_test.php index f3b0ebbe8..81ce5e394 100644 --- a/tests/codeigniter/helpers/inflector_helper_test.php +++ b/tests/codeigniter/helpers/inflector_helper_test.php @@ -10,11 +10,11 @@ class Inflector_helper_test extends CI_TestCase { public function test_singular() { $strs = array( - 'tellies' => 'telly', - 'smellies' => 'smelly', - 'abjectnesses' => 'abjectness', - 'smells' => 'smell', - 'equipment' => 'equipment' + 'tellies' => 'telly', + 'smellies' => 'smelly', + 'abjectnesses' => 'abjectness', + 'smells' => 'smell', + 'equipment' => 'equipment' ); foreach ($strs as $str => $expect) @@ -28,12 +28,12 @@ class Inflector_helper_test extends CI_TestCase { 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' + 'telly' => 'tellies', + 'smelly' => 'smellies', + 'abjectness' => 'abjectnesses', // ref : http://en.wiktionary.org/wiki/abjectnesses + 'smell' => 'smells', + 'witch' => 'witches', + 'equipment' => 'equipment' ); foreach ($strs as $str => $expect) @@ -48,9 +48,9 @@ class Inflector_helper_test extends CI_TestCase { { $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?', + '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) @@ -64,10 +64,10 @@ class Inflector_helper_test extends CI_TestCase { 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?', + '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) @@ -81,10 +81,10 @@ class Inflector_helper_test extends CI_TestCase { 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?', + '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) |