Annotation of embedaddon/php/ext/standard/tests/dir/opendir_variation3.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test opendir() function : usage variations - open a directory twice
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : mixed opendir(string $path[, resource $context])
! 6: * Description: Open a directory and return a dir_handle
! 7: * Source code: ext/standard/dir.c
! 8: */
! 9:
! 10: /*
! 11: * Call opendir() twice with the same directory as $path argument
! 12: */
! 13:
! 14: echo "*** Testing opendir() : usage variation ***\n";
! 15:
! 16: $path = dirname(__FILE__) . "/opendir_variation3";
! 17: mkdir($path);
! 18:
! 19: echo "\n-- Open directory first time: --\n";
! 20: var_dump($dh1 = opendir($path));
! 21:
! 22: echo "\n-- Open directory second time: --\n";
! 23: var_dump($dh2 = opendir($path));
! 24:
! 25: if ($dh1 !== $dh2) {
! 26: echo "\nNew resource created\n";
! 27: } else {
! 28: echo "\nNo new resource created\n";
! 29: }
! 30:
! 31: closedir($dh1);
! 32: closedir($dh2);
! 33: ?>
! 34: ===DONE===
! 35: --CLEAN--
! 36: <?php
! 37: $path = dirname(__FILE__) . "/opendir_variation3";
! 38: rmdir($path);
! 39: ?>
! 40: --EXPECTF--
! 41: *** Testing opendir() : usage variation ***
! 42:
! 43: -- Open directory first time: --
! 44: resource(%d) of type (stream)
! 45:
! 46: -- Open directory second time: --
! 47: resource(%d) of type (stream)
! 48:
! 49: New resource created
! 50: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>