summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/codeigniter/core/Utf8_test.php4
-rw-r--r--tests/codeigniter/helpers/array_helper_test.php16
-rw-r--r--tests/codeigniter/helpers/captcha_helper_test.php2
-rw-r--r--tests/codeigniter/helpers/directory_helper_test.php2
-rw-r--r--tests/codeigniter/helpers/email_helper_test.php5
-rw-r--r--tests/codeigniter/helpers/file_helper_test.php74
-rw-r--r--tests/codeigniter/helpers/inflector_helper_test.php44
-rw-r--r--tests/mocks/core/utf8.php5
8 files changed, 73 insertions, 79 deletions
diff --git a/tests/codeigniter/core/Utf8_test.php b/tests/codeigniter/core/Utf8_test.php
index 71299134e..2cf404841 100644
--- a/tests/codeigniter/core/Utf8_test.php
+++ b/tests/codeigniter/core/Utf8_test.php
@@ -18,8 +18,8 @@ class Utf8_test extends CI_TestCase {
public function test_is_ascii()
{
- $this->assertTrue($this->utf8->is_ascii_test('foo bar'));
- $this->assertFalse($this->utf8->is_ascii_test('тест'));
+ $this->assertTrue($this->utf8->is_ascii('foo bar'));
+ $this->assertFalse($this->utf8->is_ascii('тест'));
}
} \ No newline at end of file
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)
diff --git a/tests/mocks/core/utf8.php b/tests/mocks/core/utf8.php
index 30b78adfe..c8214a62a 100644
--- a/tests/mocks/core/utf8.php
+++ b/tests/mocks/core/utf8.php
@@ -13,9 +13,4 @@ class Mock_Core_Utf8 extends CI_Utf8 {
defined('UTF8_ENABLED') OR define('UTF8_ENABLED', TRUE);
}
- public function is_ascii_test($str)
- {
- return $this->_is_ascii($str);
- }
-
} \ No newline at end of file