summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/helpers
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-02-17 15:57:48 +0100
committerAndrey Andreev <narf@devilix.net>2014-02-17 15:57:48 +0100
commit53d5ee6c6e595bc80851bf933215216610c052a7 (patch)
tree9137dc959ac213a381c31f83dba8402220c1cd35 /tests/codeigniter/helpers
parentcfaf8c4ef695f78fffef9b60a05bb89e2270b78b (diff)
Enable write_file() test
Diffstat (limited to 'tests/codeigniter/helpers')
-rw-r--r--tests/codeigniter/helpers/file_helper_test.php74
1 files changed, 35 insertions, 39 deletions
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