Esempio n. 1
0
  function testWalkDir()
  {
    $this->_createFileSystem();

    $mock = new SpecialDirWalker();

    $this->assertEqual(
      Fs :: walkDir(TEST_DIR_ABSOLUTE_PATH . '/tmp/', array(&$mock, 'walk'), array('test')),
      array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
    );

    sort($mock->walked);

    $this->assertEqual(sizeof($mock->walked), 11);

    $this->assertEqual($mock->walked[0], Fs :: cleanPath(TEST_DIR_ABSOLUTE_PATH . '/tmp/test1_1'));
    $this->assertEqual($mock->walked[1], Fs :: cleanPath(TEST_DIR_ABSOLUTE_PATH . '/tmp/test1_2'));
    $this->assertEqual($mock->walked[2], Fs :: cleanPath(TEST_DIR_ABSOLUTE_PATH . '/tmp/test1_3'));
    $this->assertEqual($mock->walked[3], Fs :: cleanPath(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'));
    $this->assertEqual($mock->walked[4], Fs :: cleanPath(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey'));
    $this->assertEqual($mock->walked[5], Fs :: cleanPath(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey/test3_1'));
    $this->assertEqual($mock->walked[6], Fs :: cleanPath(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey/test3_2'));
    $this->assertEqual($mock->walked[7], Fs :: cleanPath(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey/test3_3'));
    $this->assertEqual($mock->walked[8], Fs :: cleanPath(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/test2_1'));
    $this->assertEqual($mock->walked[9], Fs :: cleanPath(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/test2_2'));
    $this->assertEqual($mock->walked[10], Fs :: cleanPath(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/test2_3'));

    $this->_removeFileSystem();
  }