From 99b782d8a3d92c4703a059cbd62e2f1e6fea689c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 9 Jun 2012 22:24:46 +0300 Subject: Cleanup and optimize helper tests for speed --- .../codeigniter/helpers/directory_helper_test.php | 47 +++++++++++++--------- 1 file changed, 28 insertions(+), 19 deletions(-) (limited to 'tests/codeigniter/helpers/directory_helper_test.php') diff --git a/tests/codeigniter/helpers/directory_helper_test.php b/tests/codeigniter/helpers/directory_helper_test.php index 3937d2913..176ff1d78 100644 --- a/tests/codeigniter/helpers/directory_helper_test.php +++ b/tests/codeigniter/helpers/directory_helper_test.php @@ -1,41 +1,50 @@ helper('directory'); vfsStreamWrapper::register(); vfsStreamWrapper::setRoot(new vfsStreamDirectory('testDir')); - + $this->_test_dir = vfsStreamWrapper::getRoot(); - } - + } + public function test_directory_map() { - $structure = array('libraries' => array('benchmark.html' => '', 'database' => - array('active_record.html' => '', 'binds.html' => ''), 'email.html' => '', '.hiddenfile.txt' => '')); - + $structure = array( + 'libraries' => array( + 'benchmark.html' => '', + 'database' => array('active_record.html' => '', 'binds.html' => ''), + 'email.html' => '', + '.hiddenfile.txt' => '' + ) + ); + vfsStream::create($structure, $this->_test_dir); // test default recursive behavior - $expected = array('libraries' => array('benchmark.html', 'database' => - array('active_record.html', 'binds.html'), 'email.html')); - - $this->assertEquals($expected, directory_map(vfsStream::url('testDir'))); + $expected = array( + 'libraries' => array( + 'benchmark.html', + 'database' => array('active_record.html', 'binds.html'), + 'email.html' + ) + ); - // test recursion depth behavior - $expected = array('libraries'); - - $this->assertEquals($expected, directory_map(vfsStream::url('testDir'), 1)); + $this->assertEquals($expected, directory_map(vfsStream::url('testDir'))); // test detection of hidden files - $expected = array('libraries' => array('benchmark.html', 'database' => - array('active_record.html', 'binds.html'), 'email.html', '.hiddenfile.txt')); - + $expected['libraries'][] = '.hiddenfile.txt'; + $this->assertEquals($expected, directory_map(vfsStream::url('testDir'), FALSE, TRUE)); - } + + // test recursion depth behavior + $this->assertEquals(array('libraries'), directory_map(vfsStream::url('testDir'), 1)); + } + } /* End of file directory_helper_test.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b