function test_is_absolute_true() { $this->assertTrue(fs :: is_absolute('/test')); if(sys :: os_type() == 'win32') $this->assertTrue(fs :: is_absolute('c:/test')); }
function test_mkdir_windows() { if (sys::os_type() != 'win32') { return; } dir::mkdir(VAR_DIR . '/./tmp\\../tmp/wow////hey/', 0777, true); $this->assertTrue(is_dir(VAR_DIR . '/tmp/wow/hey/')); }
function _determine_options() { if (sys :: os_type() == "win32") $this->ext = '.exe'; $this->_determine_read_types(); $this->_determine_write_types(); if (sizeof($this->read_types) == 0) $this->library_installed = false; else $this->library_installed = true; }
function test_walk_dir() { $this->_create_file_system(); $mock =& new special_dir_walker($this); $mock->expectCallCount('walk', 9+2); if(sys :: os_type() == 'win32') { $mock->expectArgumentsAt(0, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'test1_1', array('test', 'separator' => dir :: separator()), array(0))); $mock->expectArgumentsAt(1, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'test1_2', array('test', 'separator' => dir :: separator()), array(0, 1))); $mock->expectArgumentsAt(2, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'test1_3', array('test', 'separator' => dir :: separator()), array(0, 1, 2))); $mock->expectArgumentsAt(3, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'wow', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3))); $mock->expectArgumentsAt(4, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'hey', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4))); $mock->expectArgumentsAt(5, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey'), 'test3_1', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5))); $mock->expectArgumentsAt(6, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey'), 'test3_2', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6))); $mock->expectArgumentsAt(7, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey'), 'test3_3', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7))); $mock->expectArgumentsAt(8, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'test2_1', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7, 8))); $mock->expectArgumentsAt(9, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'test2_2', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))); $mock->expectArgumentsAt(10, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'test2_3', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10))); } elseif(sys :: os_type() == 'unix') { $mock->expectArgumentsAt(0, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'wow', array('test', 'separator' => dir :: separator()), array(0))); $mock->expectArgumentsAt(1, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'hey', array('test', 'separator' => dir :: separator()), array(0, 1))); $mock->expectArgumentsAt(2, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey'), 'test3_1', array('test', 'separator' => dir :: separator()), array(0, 1, 2))); $mock->expectArgumentsAt(3, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey'), 'test3_2', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3))); $mock->expectArgumentsAt(4, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey'), 'test3_3', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4))); $mock->expectArgumentsAt(5, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'test2_1', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5))); $mock->expectArgumentsAt(6, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'test2_2', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6))); $mock->expectArgumentsAt(7, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'test2_3', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7))); $mock->expectArgumentsAt(8, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'test1_1', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7, 8))); $mock->expectArgumentsAt(9, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'test1_2', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))); $mock->expectArgumentsAt(10, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'test1_3', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10))); } $this->assertEqual( dir :: walk_dir(TEST_DIR_ABSOLUTE_PATH . '/tmp/', array(&$mock, 'walk'), array('test')), array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) ); $mock->tally(); $this->_remove_file_system(); }
function _has_win32_net_prefix($path) { if(sys :: os_type() == 'win32' && strlen($path) > 2) { return (substr($path, 0, 2) == WIN32_NET_PREFIX); } return false; }
function is_mac() { return sys :: os_type() == 'mac'; }