[PHP-CVS] cvs: php-src /ext/standard/tests/general_functions is_callable.phpt is_callable_basic1.phpt is_callable_basic2.phpt is_callable_error.phpt is_callable_variation1.phpt is_callable_variation2.
wharmby Sun Jan 25 22:16:38 2009 UTC Removed files: /php-src/ext/standard/tests/general_functions is_callable.phpt Modified files: /php-src/ext/standard/tests/general_functions is_callable_error.phpt is_callable_basic1.phpt is_callable_variation1.phpt is_callable_variation2.phpt is_callable_basic2.phpt Log: Split is_callable test. Test on Windows, Linux and Linux 64 bit http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/is_callable_error.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/ext/standard/tests/general_functions/is_callable_error.phpt diff -u /dev/null php-src/ext/standard/tests/general_functions/is_callable_error.phpt:1.2 --- /dev/null Sun Jan 25 22:16:38 2009 +++ php-src/ext/standard/tests/general_functions/is_callable_error.phpt Sun Jan 25 22:16:37 2009 @@ -0,0 +1,35 @@ +--TEST-- +Test is_callable() function +--INI-- +precision=14 +error_reporting = E_ALL ~E_NOTICE | E_STRICT +--FILE-- +?php +/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string $callable_name]] ); + Description: Verify that the contents of a variable can be called as a function +In case of objects, $var = array($SomeObject, 'MethodName') +*/ + +echo \n*** Testing error conditions ***\n; + +echo \n-- Testing is_callable() function with less than expected no. of arguments --\n; +var_dump( is_callable() ); + +echo \n-- Testing is_callable() function with more than expected no. of arguments --\n; +var_dump( is_callable(string, TRUE, $callable_name, EXTRA) ); + +? +===DONE=== +--EXPECTF-- +*** Testing error conditions *** + +-- Testing is_callable() function with less than expected no. of arguments -- + +Warning: is_callable() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing is_callable() function with more than expected no. of arguments -- + +Warning: is_callable() expects at most 3 parameters, 4 given in %s on line %d +NULL +===DONE=== \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/is_callable_basic1.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/ext/standard/tests/general_functions/is_callable_basic1.phpt diff -u /dev/null php-src/ext/standard/tests/general_functions/is_callable_basic1.phpt:1.2 --- /dev/null Sun Jan 25 22:16:38 2009 +++ php-src/ext/standard/tests/general_functions/is_callable_basic1.phpt Sun Jan 25 22:16:37 2009 @@ -0,0 +1,109 @@ +--TEST-- +Test is_callable() function : usage variations - defined functions +--INI-- +precision=14 +error_reporting = E_ALL ~E_NOTICE | E_STRICT +--FILE-- +?php +/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string $callable_name]] ); + * Description: Verify that the contents of a variable can be called as a function + * Source code: ext/imap/php_imap.c + */ + +/* Prototype: void check_iscallable( $functions ); + Description: use iscallable() on given string to check for valid function name +returns true if valid function name, false otherwise +*/ +function check_iscallable( $functions ) { + $counter = 1; + foreach($functions as $func) { +echo -- Iteration $counter --\n; +var_dump( is_callable($func) ); //given only $var argument +var_dump( is_callable($func, TRUE) ); //given $var and $syntax argument +var_dump( is_callable($func, TRUE, $callable_name) ); +echo $callable_name, \n; +var_dump( is_callable($func, FALSE) ); //given $var and $syntax argument +var_dump( is_callable($func, FALSE, $callable_name) ); +echo $callable_name, \n; +$counter++; + } +} + +echo \n*** Testing is_callable() on defined functions ***\n; +/* function name with simple string */ +function someFunction() { +} + +/* function name with mixed string and integer */ +function x123() { +} + +/* function name as NULL */ +function NULL() { +} + +/* function name with boolean name */ +function false() { +} + +/* function name with string and special character */ +function Hello_World() { +} + +$defined_functions = array ( + $functionVar1 = 'someFunction', + $functionVar2 = 'x123', + $functionVar3 = 'NULL', + $functionVar4 = 'false', + $functionVar5 = Hello_World +); +/* use check_iscallable() to check whether given string is valid function name + * expected: true as it is valid callback + */ +check_iscallable($defined_functions); + +? +===DONE=== +--EXPECT--- +*** Testing is_callable() on defined functions *** +-- Iteration 1 -- +bool(true) +bool(true) +bool(true) +someFunction +bool(true) +bool(true) +someFunction +-- Iteration 2 -- +bool(true) +bool(true) +bool(true) +x123 +bool(true) +bool(true) +x123 +--
[PHP-CVS] cvs: php-src /ext/standard/tests/general_functions is_callable.phpt
felipe Mon Feb 4 17:21:01 2008 UTC Modified files: /php-src/ext/standard/tests/general_functions is_callable.phpt Log: Fix error messages http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/is_callable.phpt?r1=1.4r2=1.5diff_format=u Index: php-src/ext/standard/tests/general_functions/is_callable.phpt diff -u php-src/ext/standard/tests/general_functions/is_callable.phpt:1.4 php-src/ext/standard/tests/general_functions/is_callable.phpt:1.5 --- php-src/ext/standard/tests/general_functions/is_callable.phpt:1.4 Tue Sep 11 05:23:45 2007 +++ php-src/ext/standard/tests/general_functions/is_callable.phpt Mon Feb 4 17:21:01 2008 @@ -479,15 +479,15 @@ object_class::func -- Innerloop iteration 10 of Outerloop iteration 1 -- -Strict Standards: Non-static method object_class::foo1() cannot be called statically in %s on line %d +Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d bool(true) bool(true) -Strict Standards: Non-static method object_class::foo1() cannot be called statically in %s on line %d +Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d bool(true) bool(true) -Strict Standards: Non-static method object_class::foo1() cannot be called statically in %s on line %d +Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d bool(true) object_class::foo1 --- Outerloop iteration 2 --- @@ -556,15 +556,15 @@ no_member_class::func -- Innerloop iteration 10 of Outerloop iteration 2 -- -Strict Standards: Non-static method object_class::foo1() cannot be called statically in %s on line %d +Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d bool(true) bool(true) -Strict Standards: Non-static method object_class::foo1() cannot be called statically in %s on line %d +Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d bool(true) bool(true) -Strict Standards: Non-static method object_class::foo1() cannot be called statically in %s on line %d +Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d bool(true) object_class::foo1 --- Outerloop iteration 3 --- @@ -633,15 +633,15 @@ contains_object_class::func -- Innerloop iteration 10 of Outerloop iteration 3 -- -Strict Standards: Non-static method object_class::foo1() cannot be called statically in %s on line %d +Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d bool(true) bool(true) -Strict Standards: Non-static method object_class::foo1() cannot be called statically in %s on line %d +Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d bool(true) bool(true) -Strict Standards: Non-static method object_class::foo1() cannot be called statically in %s on line %d +Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d bool(true) object_class::foo1 --- Outerloop iteration 4 --- @@ -710,15 +710,15 @@ contains_object_class::func -- Innerloop iteration 10 of Outerloop iteration 4 -- -Strict Standards: Non-static method object_class::foo1() cannot be called statically in %s on line %d +Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d bool(true) bool(true) -Strict Standards: Non-static method object_class::foo1() cannot be called statically in %s on line %d +Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d bool(true) bool(true) -Strict Standards: Non-static method object_class::foo1() cannot be called statically in %s on line %d +Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d bool(true) object_class::foo1 --- Outerloop iteration 5 --- @@ -787,15 +787,15 @@ object_class::func -- Innerloop iteration 10 of Outerloop iteration 5 -- -Strict Standards: Non-static method object_class::foo1() cannot be called statically in %s on line %d +Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d bool(true) bool(true) -Strict Standards: Non-static method object_class::foo1() cannot be called statically in %s on line %d +Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d bool(true) bool(true) -Strict Standards: Non-static method object_class::foo1() cannot be called statically in %s on line %d +Strict Standards: Non-static method object_class::foo1() should not be called statically in %s on line %d bool(true) object_class::foo1 --- Outerloop iteration 6 --- @@ -864,15 +864,15 @@
[PHP-CVS] cvs: php-src /ext/standard/tests/general_functions is_callable.phpt
kraghubaTue Sep 11 05:23:45 2007 UTC Modified files: /php-src/ext/standard/tests/general_functions is_callable.phpt Log: fix test http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/is_callable.phpt?r1=1.3r2=1.4diff_format=u Index: php-src/ext/standard/tests/general_functions/is_callable.phpt diff -u php-src/ext/standard/tests/general_functions/is_callable.phpt:1.3 php-src/ext/standard/tests/general_functions/is_callable.phpt:1.4 --- php-src/ext/standard/tests/general_functions/is_callable.phpt:1.3 Thu Jul 12 09:26:28 2007 +++ php-src/ext/standard/tests/general_functions/is_callable.phpt Tue Sep 11 05:23:45 2007 @@ -2,6 +2,7 @@ Test is_callable() function --INI-- precision=14 +error_reporting = E_ALL ~E_NOTICE | E_STRICT --FILE-- ?php /* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string $callable_name]] ); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard/tests/general_functions is_callable.phpt
tony2001Thu Jul 12 09:26:29 2007 UTC Modified files: /php-src/ext/standard/tests/general_functions is_callable.phpt Log: fix test http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/is_callable.phpt?r1=1.2r2=1.3diff_format=u Index: php-src/ext/standard/tests/general_functions/is_callable.phpt diff -u php-src/ext/standard/tests/general_functions/is_callable.phpt:1.2 php-src/ext/standard/tests/general_functions/is_callable.phpt:1.3 --- php-src/ext/standard/tests/general_functions/is_callable.phpt:1.2 Tue Jun 5 09:21:54 2007 +++ php-src/ext/standard/tests/general_functions/is_callable.phpt Thu Jul 12 09:26:28 2007 @@ -1,5 +1,7 @@ --TEST-- Test is_callable() function +--INI-- +precision=14 --FILE-- ?php /* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string $callable_name]] ); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php