diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/codeigniter/helpers/directory_helper_test.php | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/codeigniter/helpers/directory_helper_test.php b/tests/codeigniter/helpers/directory_helper_test.php index 41370e6e7..d86047349 100644 --- a/tests/codeigniter/helpers/directory_helper_test.php +++ b/tests/codeigniter/helpers/directory_helper_test.php @@ -14,6 +14,8 @@ class Directory_helper_test extends CI_TestCase { public function test_directory_map() { + $ds = DIRECTORY_SEPARATOR; + $structure = array( 'libraries' => array( 'benchmark.html' => '', @@ -26,11 +28,18 @@ class Directory_helper_test extends CI_TestCase { vfsStream::create($structure, $this->_test_dir); + // opendir() seems to fail on Windows + vfsStream when there are trailing slashes in directory names + if ( ! @opendir(vfsStream::url('testDir'))) + { + $this->markTestSkipped(); + return; + } + // test default recursive behavior $expected = array( - 'libraries/' => array( + 'libraries'.$ds => array( 'benchmark.html', - 'database/' => array('active_record.html', 'binds.html'), + 'database'.$ds => array('active_record.html', 'binds.html'), 'email.html', '0' ) @@ -39,12 +48,12 @@ class Directory_helper_test extends CI_TestCase { $this->assertEquals($expected, directory_map(vfsStream::url('testDir'))); // test detection of hidden files - $expected['libraries/'][] = '.hiddenfile.txt'; + $expected['libraries'.$ds][] = '.hiddenfile.txt'; - $this->assertEquals($expected, directory_map(vfsStream::url('testDir'), FALSE, TRUE)); + $this->assertEquals($expected, directory_map(vfsStream::url('testDir'), 0, TRUE)); // test recursion depth behavior - $this->assertEquals(array('libraries/'), directory_map(vfsStream::url('testDir'), 1)); + $this->assertEquals(array('libraries'.$ds), directory_map(vfsStream::url('testDir'), 1)); } } |