File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / dir / opendir_error1.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:03 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Test opendir() function : error conditions - Incorrect number of args
--FILE--
<?php
/* Prototype  : mixed opendir(string $path[, resource $context])
 * Description: Open a directory and return a dir_handle 
 * Source code: ext/standard/dir.c
 */

/*
 * Pass incorrect number of arguments to opendir() to test behaviour
 */

echo "*** Testing opendir() : error conditions ***\n";

// Zero arguments
echo "\n-- Testing opendir() function with Zero arguments --\n";
var_dump( opendir() );

//Test opendir with one more than the expected number of arguments
echo "\n-- Testing opendir() function with more than expected no. of arguments --\n";
$path = dirname(__FILE__) . "/opendir_error";
mkdir($path);
$context = stream_context_create();

$extra_arg = 10;
var_dump( opendir($path, $context, $extra_arg) );
?>
===DONE===
--CLEAN--
<?php
$path = dirname(__FILE__) . "/opendir_error";
rmdir($path);
?>
--EXPECTF--
*** Testing opendir() : error conditions ***

-- Testing opendir() function with Zero arguments --

Warning: opendir() expects at least 1 parameter, 0 given in %s on line %d
NULL

-- Testing opendir() function with more than expected no. of arguments --

Warning: opendir() expects at most 2 parameters, 3 given in %s on line %d
NULL
===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>