wharmby Sun Feb 1 18:55:28 2009 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/general_functions
get_magic_quotes_gpc.phpt
get_magic_quotes_runtime.phpt
get_include_path_basic.phpt
get_included_files_inc1.inc
get_included_files_inc3.inc
get_defined_vars_basic.phpt
get_included_files_inc2.inc
get_included_files.phpt
getmypid_basic.phpt
Log:
New get_defined_vars(), get_included_files(), get_magic_quotes() and
getmypid() tests. Tested on Winows, Linux and Linux 64
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt
+++ php-src/ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt
--TEST--
Test get_magic_quotes_gpc() function
--FILE--
<?php
/* Prototype: int get_magic_quotes_gpc ( void )
* Description: Gets the current configuration setting of magic quotes gpc
*
* On PHP 6 this function always returns FALSE
*/
echo "Simple testcase for get_magic_quotes_gpc() function\n";
var_dump(get_magic_quotes_gpc());
echo "\n-- Error cases --\n";
// no checks on number of args
var_dump(get_magic_quotes_gpc(true));
?>
===DONE===
--EXPECT--
Simple testcase for get_magic_quotes_gpc() function
bool(false)
-- Error cases --
bool(false)
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt?view=markup&rev=1.1
Index:
php-src/ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt
+++ php-src/ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt
--TEST--
Test get_magic_quotes_runtime() function
--FILE--
<?php
/* Prototype: int get_magic_quotes_runtime ( void )
* Description: Gets the current active configuration setting of
magic_quotes_runtime
*
* On PHP 6 this function always returns FALSE
*/
echo "Simple testcase for get_magic_quotes_runtime() function\n";
var_dump(get_magic_quotes_runtime());
echo "\n-- Error cases --\n";
// no checks on number of args
var_dump(get_magic_quotes_runtime(true));
?>
===DONE===
--EXPECTF--
Simple testcase for get_magic_quotes_runtime() function
bool(false)
-- Error cases --
bool(false)
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/get_include_path_basic.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/general_functions/get_include_path_basic.phpt
+++ php-src/ext/standard/tests/general_functions/get_include_path_basic.phpt
--TEST--
Test get_include_path() function
--INI--
include_path=.
--FILE--
<?php
/* Prototype: string get_include_path ( void )
* Description: Gets the current include_path configuration option
*/
echo "*** Testing get_include_path()\n";
var_dump(get_include_path());
if (ini_get("include_path") == get_include_path()) {
echo "PASSED\n";
} else {
echo "FAILED\n";
}
echo "\nError cases:\n";
var_dump(get_include_path(TRUE));
?>
===DONE===
--EXPECTF--
*** Testing get_include_path()
unicode(1) "."
PASSED
Error cases:
Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line
%d
NULL
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/get_included_files_inc1.inc?view=markup&rev=1.1
Index: php-src/ext/standard/tests/general_functions/get_included_files_inc1.inc
+++ php-src/ext/standard/tests/general_functions/get_included_files_inc1.inc
<?php
/* dummy include*/
?>
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/get_included_files_inc3.inc?view=markup&rev=1.1
Index: php-src/ext/standard/tests/general_functions/get_included_files_inc3.inc
+++ php-src/ext/standard/tests/general_functions/get_included_files_inc3.inc
<?php
/* dummy include*/
include(dirname(__FILE__)."/get_included_files_inc1.inc");
?>
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/get_defined_vars_basic.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/general_functions/get_defined_vars_basic.phpt
+++ php-src/ext/standard/tests/general_functions/get_defined_vars_basic.phpt
--TEST--
Test get_defined_vars() function
--FILE--
<?php
/* Prototype: array get_defined_vars ( void )
Description: This function returns a multidimensional array containing a
list of all defined
variables, be them environment, server or user-defined variables, within the
scope that
get_defined_vars() is called.
*/
echo "Simple testcase for get_defined_vars() function\n\n";
function f1() {
echo "\n-- Function f1() called --\n";
$vars = get_defined_vars();
if (count($vars) != 0) {
echo "TEST FAILED\n";
}
echo "\n-- ..define some local variables --\n";
$i = 123;
$f = 123.456;
$b = false;
$s = "Hello World";
$arr = array(1,2,3,4);
var_dump( get_defined_vars() );
f2();
}
function f2() {
echo "\n -- Function f2() called --\n";
$vars= get_defined_vars();
if (count($vars) != 0) {
echo "TEST FAILED\n";
}
echo "\n-- ...define some variables --\n";
$i = 456;
$f = 456.678;
$b = true;
$s = "Goodnight";
$arr = array("foo", "bar");
var_dump( get_defined_vars() );
echo "\n-- ...define some more variables --\n";
$i1 = 456;
$f1 = 456.678;
$b1 = true;
var_dump( get_defined_vars() );
}
echo "\n-- Get variables at global scope --\n";
$vars = get_defined_vars();
if (count($vars) == 0) {
echo "TEST FAILED - Global variables missing at global scope\n";
}
// call a function
f1();
?>
===DONE===
--EXPECT--
Simple testcase for get_defined_vars() function
-- Get variables at global scope --
-- Function f1() called --
-- ..define some local variables --
array(6) {
[u"vars"]=>
array(0) {
}
[u"i"]=>
int(123)
[u"f"]=>
float(123.456)
[u"b"]=>
bool(false)
[u"s"]=>
unicode(11) "Hello World"
[u"arr"]=>
array(4) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
}
}
-- Function f2() called --
-- ...define some variables --
array(6) {
[u"vars"]=>
array(0) {
}
[u"i"]=>
int(456)
[u"f"]=>
float(456.678)
[u"b"]=>
bool(true)
[u"s"]=>
unicode(9) "Goodnight"
[u"arr"]=>
array(2) {
[0]=>
unicode(3) "foo"
[1]=>
unicode(3) "bar"
}
}
-- ...define some more variables --
array(9) {
[u"vars"]=>
array(0) {
}
[u"i"]=>
int(456)
[u"f"]=>
float(456.678)
[u"b"]=>
bool(true)
[u"s"]=>
unicode(9) "Goodnight"
[u"arr"]=>
array(2) {
[0]=>
unicode(3) "foo"
[1]=>
unicode(3) "bar"
}
[u"i1"]=>
int(456)
[u"f1"]=>
float(456.678)
[u"b1"]=>
bool(true)
}
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/get_included_files_inc2.inc?view=markup&rev=1.1
Index: php-src/ext/standard/tests/general_functions/get_included_files_inc2.inc
+++ php-src/ext/standard/tests/general_functions/get_included_files_inc2.inc
<?php
/* dummy include*/
include(dirname(__FILE__)."/get_included_files_inc3.inc");
?>
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/get_included_files.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/general_functions/get_included_files.phpt
+++ php-src/ext/standard/tests/general_functions/get_included_files.phpt
--TEST--
Test get_include_files() function
--INI--
include_path=.
--FILE--
<?php
/* Prototype: array get_included_files ( void )
* Description: Returns an array with the names of included or required files
*/
echo "*** Testing get_included_files()\n";
echo "\n-- List included files at start --\n";
var_dump(get_included_files());
include(dirname(__FILE__)."/get_included_files_inc1.inc");
echo "\n-- List included files atfter including inc1 -\n";
var_dump(get_included_files());
include(dirname(__FILE__)."/get_included_files_inc2.inc");
echo "\n-- List included files atfter including inc2 which will include inc3
which includes inc1 --\n";
var_dump(get_included_files());
echo "\n-- Error cases --\n";
var_dump(get_included_files(true));
?>
===DONE===
--EXPECTF--
*** Testing get_included_files()
-- List included files at start --
array(1) {
[0]=>
unicode(%d) "%sget_included_files.php"
}
-- List included files atfter including inc1 -
array(2) {
[0]=>
unicode(%d) "%sget_included_files.php"
[1]=>
unicode(%d) "%sget_included_files_inc1.inc"
}
-- List included files atfter including inc2 which will include inc3 which
includes inc1 --
array(4) {
[0]=>
unicode(%d) "%sget_included_files.php"
[1]=>
unicode(%d) "%sget_included_files_inc1.inc"
[2]=>
unicode(%d) "%sget_included_files_inc2.inc"
[3]=>
unicode(%d) "%sget_included_files_inc3.inc"
}
-- Error cases --
Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on
line %d
NULL
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/getmypid_basic.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/general_functions/getmypid_basic.phpt
+++ php-src/ext/standard/tests/general_functions/getmypid_basic.phpt
--TEST--
Test getmypid() function: basic test
--FILE--
<?php
/* Prototype : int getmypid ( void )
* Description: Gets the current PHP process ID.
* Source code: ext/standard/pageinfo.c
* Alias to functions:
*/
echo "Simple testcase for getmypid() function\n";
var_dump(getmypid());
echo "Done\n";
?>
--EXPECTF--
Simple testcase for getmypid() function
int(%d)
Done
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php