wharmby         Tue Jun 16 08:59:42 2009 UTC

  Modified files:              
    /php-src/ext/standard/tests/class_object    
                                                
interface_exists_variation3.phpt 
                                                
is_subclass_of_variation_004.phpt 
                                                
get_declared_classes_variation1.phpt 
                                                
interface_exists_variation1.phpt 
                                                AutoTest.inc 
                                                property_exists_variation1.phpt 
                                                AutoInterface.inc 
                                                
interface_exists_variation4.phpt 
                                                AutoLoaded.inc 
                                                interface_exists_error.phpt 
                                                get_class_vars_variation1.phpt 
                                                
interface_exists_variation2.phpt 
                                                get_class_vars_variation2.phpt 
                                                property_exists_error.phpt 
                                                
get_declared_interfaces_variation1.phpt 
                                                get_class_vars_error.phpt 
  Log:
  New class related tests. Tested on Windows, Linux and Linux 64. Tests written 
by  Iain Lewis
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/interface_exists_variation3.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/class_object/interface_exists_variation3.phpt
diff -u /dev/null 
php-src/ext/standard/tests/class_object/interface_exists_variation3.phpt:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ php-src/ext/standard/tests/class_object/interface_exists_variation3.phpt    
Tue Jun 16 08:59:42 2009
@@ -0,0 +1,35 @@
+--TEST--
+Test interface_exists() function : autoloaded interface 
+--FILE--
+<?php
+/* Prototype  : bool interface_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists 
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing interface_exists() : autoloaded interface ***\n";
+
+function __autoload($class_name) {
+    require_once $class_name . '.inc';
+}
+
+echo "\n-- no autoloading --\n";
+var_dump(interface_exists("AutoInterface", false));
+
+echo "\n-- with autoloading --\n";
+var_dump(interface_exists("AutoInterface", true));
+
+echo "\nDONE\n";
+
+?>
+--EXPECTF--
+*** Testing interface_exists() : autoloaded interface ***
+
+-- no autoloading --
+bool(false)
+
+-- with autoloading --
+bool(true)
+
+DONE
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt
diff -u /dev/null 
php-src/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ php-src/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt   
Tue Jun 16 08:59:42 2009
@@ -0,0 +1,180 @@
+--TEST--
+Test is_subclass_of() function : usage variations  - unexpected type for arg 1 
with valid class in arg 2.
+--FILE--
+<?php
+/* Prototype  : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its 
parents 
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions: 
+ */
+// Note: basic use cases in Zend/tests/is_a.phpt
+function __autoload($className) {
+       echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+       echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+
+echo "*** Testing is_subclass_of() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$class_name = 'stdClass';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+      // int data
+      0,
+      1,
+      12345,
+      -2345,
+
+      // float data
+      10.5,
+      -10.5,
+      10.1234567e10,
+      10.7654321E-10,
+      .5,
+
+      // array data
+      array(),
+      array(0),
+      array(1),
+      array(1, 2),
+      array('color' => 'red', 'item' => 'pen'),
+
+      // null data
+      NULL,
+      null,
+
+      // boolean data
+      true,
+      false,
+      TRUE,
+      FALSE,
+
+      // empty data
+      "",
+      '',
+
+      // string data
+      "string",
+      'String',
+
+      // undefined data
+      $undefined_var,
+
+      // unset data
+      $unset_var,
+);
+
+// loop through each element of the array for object
+
+foreach($values as $value) {
+      echo "\nArg value $value \n";
+      var_dump( is_subclass_of($value, $class_name) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing is_subclass_of() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, 
%sis_subclass_of_variation_004.php(69)
+Error: 8 - Undefined variable: unset_var, 
%sis_subclass_of_variation_004.php(72)
+
+Arg value 0 
+bool(false)
+
+Arg value 1 
+bool(false)
+
+Arg value 12345 
+bool(false)
+
+Arg value -2345 
+bool(false)
+
+Arg value 10.5 
+bool(false)
+
+Arg value -10.5 
+bool(false)
+
+Arg value 101234567000 
+bool(false)
+
+Arg value 1.07654321E-9 
+bool(false)
+
+Arg value 0.5 
+bool(false)
+Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(78)
+
+Arg value Array 
+bool(false)
+Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(78)
+
+Arg value Array 
+bool(false)
+Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(78)
+
+Arg value Array 
+bool(false)
+Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(78)
+
+Arg value Array 
+bool(false)
+Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(78)
+
+Arg value Array 
+bool(false)
+
+Arg value  
+bool(false)
+
+Arg value  
+bool(false)
+
+Arg value 1 
+bool(false)
+
+Arg value  
+bool(false)
+
+Arg value 1 
+bool(false)
+
+Arg value  
+bool(false)
+
+Arg value  
+Error: 2 - Unknown class passed as parameter, 
%sis_subclass_of_variation_004.php(79)
+bool(false)
+
+Arg value  
+Error: 2 - Unknown class passed as parameter, 
%sis_subclass_of_variation_004.php(79)
+bool(false)
+
+Arg value string 
+In __autoload(string)
+Error: 2 - Unknown class passed as parameter, 
%sis_subclass_of_variation_004.php(79)
+bool(false)
+
+Arg value String 
+In __autoload(String)
+Error: 2 - Unknown class passed as parameter, 
%sis_subclass_of_variation_004.php(79)
+bool(false)
+
+Arg value  
+bool(false)
+
+Arg value  
+bool(false)
+===DONE===
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/get_declared_classes_variation1.phpt?r1=1.1&r2=1.2&diff_format=u
Index: 
php-src/ext/standard/tests/class_object/get_declared_classes_variation1.phpt
diff -u /dev/null 
php-src/ext/standard/tests/class_object/get_declared_classes_variation1.phpt:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ 
php-src/ext/standard/tests/class_object/get_declared_classes_variation1.phpt    
    Tue Jun 16 08:59:42 2009
@@ -0,0 +1,37 @@
+--TEST--
+Test get_declared_classes() function : testing autoloaded classes 
+--FILE--
+<?php
+/* Prototype  : proto array get_declared_classes()
+ * Description: Returns an array of all declared classes. 
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions: 
+ */
+
+
+echo "*** Testing get_declared_classes() : testing autoloaded classes ***\n";
+
+function __autoload($class_name) {
+    require_once $class_name . '.inc';
+}
+
+echo "\n-- before instance is declared --\n";
+var_dump(in_array('AutoLoaded', get_declared_classes()));
+
+echo "\n-- after instance is declared --\n";
+$class = new AutoLoaded();
+var_dump(in_array('AutoLoaded', get_declared_classes()));
+
+echo "\nDONE\n";
+
+?>
+--EXPECTF--
+*** Testing get_declared_classes() : testing autoloaded classes ***
+
+-- before instance is declared --
+bool(false)
+
+-- after instance is declared --
+bool(true)
+
+DONE
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/interface_exists_variation1.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/class_object/interface_exists_variation1.phpt
diff -u /dev/null 
php-src/ext/standard/tests/class_object/interface_exists_variation1.phpt:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ php-src/ext/standard/tests/class_object/interface_exists_variation1.phpt    
Tue Jun 16 08:59:42 2009
@@ -0,0 +1,184 @@
+--TEST--
+Test interface_exists() function : usage variation 
+--FILE--
+<?php
+/* Prototype  : bool interface_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists 
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing interface_exists() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$autoload = true;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+       public function __toString() {
+               return "Class A object";
+       }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+      // int data
+      'int 0' => 0,
+      'int 1' => 1,
+      'int 12345' => 12345,
+      'int -12345' => -2345,
+
+      // float data
+      'float 10.5' => 10.5,
+      'float -10.5' => -10.5,
+      'float 12.3456789000e10' => 12.3456789000e10,
+      'float -12.3456789000e10' => -12.3456789000e10,
+      'float .5' => .5,
+
+      // array data
+      'empty array' => array(),
+      'int indexed array' => $index_array,
+      'associative array' => $assoc_array,
+      'nested arrays' => array('foo', $index_array, $assoc_array),
+
+      // null data
+      'uppercase NULL' => NULL,
+      'lowercase null' => null,
+
+      // boolean data
+      'lowercase true' => true,
+      'lowercase false' =>false,
+      'uppercase TRUE' =>TRUE,
+      'uppercase FALSE' =>FALSE,
+
+      // empty data
+      'empty string DQ' => "",
+      'empty string SQ' => '',
+
+      // object data
+      'instance of classWithToString' => new classWithToString(),
+      'instance of classWithoutToString' => new classWithoutToString(),
+
+      // undefined data
+      'undefined var' => @$undefined_var,
+
+      // unset data
+      'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for classname
+
+foreach($inputs as $key =>$value) {
+      echo "\n--$key--\n";
+      var_dump( interface_exists($value, $autoload) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing interface_exists() : usage variation ***
+
+--int 0--
+bool(false)
+
+--int 1--
+bool(false)
+
+--int 12345--
+bool(false)
+
+--int -12345--
+bool(false)
+
+--float 10.5--
+bool(false)
+
+--float -10.5--
+bool(false)
+
+--float 12.3456789000e10--
+bool(false)
+
+--float -12.3456789000e10--
+bool(false)
+
+--float .5--
+bool(false)
+
+--empty array--
+
+Warning: interface_exists() expects parameter 1 to be string (Unicode or 
binary), array given in %sinterface_exists_variation1.php on line %d
+NULL
+
+--int indexed array--
+
+Warning: interface_exists() expects parameter 1 to be string (Unicode or 
binary), array given in %sinterface_exists_variation1.php on line %d
+NULL
+
+--associative array--
+
+Warning: interface_exists() expects parameter 1 to be string (Unicode or 
binary), array given in %sinterface_exists_variation1.php on line %d
+NULL
+
+--nested arrays--
+
+Warning: interface_exists() expects parameter 1 to be string (Unicode or 
binary), array given in %sinterface_exists_variation1.php on line %d
+NULL
+
+--uppercase NULL--
+bool(false)
+
+--lowercase null--
+bool(false)
+
+--lowercase true--
+bool(false)
+
+--lowercase false--
+bool(false)
+
+--uppercase TRUE--
+bool(false)
+
+--uppercase FALSE--
+bool(false)
+
+--empty string DQ--
+bool(false)
+
+--empty string SQ--
+bool(false)
+
+--instance of classWithToString--
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: interface_exists() expects parameter 1 to be string (Unicode or 
binary), object given in %sinterface_exists_variation1.php on line %d
+NULL
+
+--undefined var--
+bool(false)
+
+--unset var--
+bool(false)
+===DONE===
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/AutoTest.inc?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/class_object/AutoTest.inc
diff -u /dev/null php-src/ext/standard/tests/class_object/AutoTest.inc:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ php-src/ext/standard/tests/class_object/AutoTest.inc        Tue Jun 16 
08:59:42 2009
@@ -0,0 +1,13 @@
+<?php
+
+class autoTest {
+  public static $bob = "bob";
+  
+    public function __get($name) {
+    echo "attempt to access $name\n";
+    return "foo";
+  }
+  
+}
+
+?>
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/property_exists_variation1.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/class_object/property_exists_variation1.phpt
diff -u /dev/null 
php-src/ext/standard/tests/class_object/property_exists_variation1.phpt:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ php-src/ext/standard/tests/class_object/property_exists_variation1.phpt     
Tue Jun 16 08:59:42 2009
@@ -0,0 +1,33 @@
+--TEST--
+Test property_exists() function : class auto loading  
+--FILE--
+<?php
+/* Prototype  : bool property_exists(mixed object_or_class, string 
property_name)
+ * Description: Checks if the object or class has a property 
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing property_exists() : class auto loading ***\n";
+
+function __autoload($class_name) {
+    require_once $class_name . '.inc';
+}
+
+echo "\ntesting property in autoloaded class\n";
+var_dump(property_exists("AutoTest", "bob"));
+
+echo "\ntesting __get magic method\n";
+var_dump(property_exists("AutoTest", "foo"));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing property_exists() : class auto loading ***
+
+testing property in autoloaded class
+bool(true)
+
+testing __get magic method
+bool(false)
+===DONE===
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/AutoInterface.inc?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/class_object/AutoInterface.inc
diff -u /dev/null php-src/ext/standard/tests/class_object/AutoInterface.inc:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ php-src/ext/standard/tests/class_object/AutoInterface.inc   Tue Jun 16 
08:59:42 2009
@@ -0,0 +1,5 @@
+<?php
+
+Interface AutoInterface {}
+
+?>
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/interface_exists_variation4.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/class_object/interface_exists_variation4.phpt
diff -u /dev/null 
php-src/ext/standard/tests/class_object/interface_exists_variation4.phpt:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ php-src/ext/standard/tests/class_object/interface_exists_variation4.phpt    
Tue Jun 16 08:59:42 2009
@@ -0,0 +1,27 @@
+--TEST--
+Test interface_exists() function : test autoload default value 
+--FILE--
+<?php
+/* Prototype  : bool interface_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists 
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing interface_exists() : test autoload default value ***\n";
+
+function __autoload($class_name) {
+    require_once $class_name . '.inc';
+}
+
+
+var_dump(interface_exists("AutoInterface"));
+
+echo "\nDONE\n";
+
+?>
+--EXPECTF--
+*** Testing interface_exists() : test autoload default value ***
+bool(true)
+
+DONE
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/AutoLoaded.inc?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/class_object/AutoLoaded.inc
diff -u /dev/null php-src/ext/standard/tests/class_object/AutoLoaded.inc:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ php-src/ext/standard/tests/class_object/AutoLoaded.inc      Tue Jun 16 
08:59:42 2009
@@ -0,0 +1,5 @@
+<?php
+
+class AutoLoaded {}
+
+?>
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/interface_exists_error.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/class_object/interface_exists_error.phpt
diff -u /dev/null 
php-src/ext/standard/tests/class_object/interface_exists_error.phpt:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ php-src/ext/standard/tests/class_object/interface_exists_error.phpt Tue Jun 
16 08:59:42 2009
@@ -0,0 +1,38 @@
+--TEST--
+Test interface_exists() function : error conditions 
+--FILE--
+<?php
+/* Prototype  : bool interface_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists 
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing interface_exists() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing interface_exists() function with Zero arguments --\n";
+var_dump( interface_exists() );
+
+//Test interface_exists with one more than the expected number of arguments
+echo "\n-- Testing interface_exists() function with more than expected no. of 
arguments --\n";
+$classname = 'string_val';
+$autoload = true;
+$extra_arg = 10;
+var_dump( interface_exists($classname, $autoload, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing interface_exists() : error conditions ***
+
+-- Testing interface_exists() function with Zero arguments --
+
+Warning: interface_exists() expects at least 1 parameter, 0 given in 
%sinterface_exists_error.php on line %d
+NULL
+
+-- Testing interface_exists() function with more than expected no. of 
arguments --
+
+Warning: interface_exists() expects at most 2 parameters, 3 given in 
%sinterface_exists_error.php on line %d
+NULL
+===DONE===
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/get_class_vars_variation1.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/class_object/get_class_vars_variation1.phpt
diff -u /dev/null 
php-src/ext/standard/tests/class_object/get_class_vars_variation1.phpt:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ php-src/ext/standard/tests/class_object/get_class_vars_variation1.phpt      
Tue Jun 16 08:59:42 2009
@@ -0,0 +1,181 @@
+--TEST--
+Test get_class_vars() function : usage variation 
+--FILE--
+<?php
+/* Prototype  : array get_class_vars(string class_name)
+ * Description: Returns an array of default properties of the class. 
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing get_class_vars() : usage variation ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+       public function __toString() {
+               return "Class A object";
+       }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+      // int data
+      'int 0' => 0,
+      'int 1' => 1,
+      'int 12345' => 12345,
+      'int -12345' => -2345,
+
+      // float data
+      'float 10.5' => 10.5,
+      'float -10.5' => -10.5,
+      'float 12.3456789000e10' => 12.3456789000e10,
+      'float -12.3456789000e10' => -12.3456789000e10,
+      'float .5' => .5,
+
+      // array data
+      'empty array' => array(),
+      'int indexed array' => $index_array,
+      'associative array' => $assoc_array,
+      'nested arrays' => array('foo', $index_array, $assoc_array),
+
+      // null data
+      'uppercase NULL' => NULL,
+      'lowercase null' => null,
+
+      // boolean data
+      'lowercase true' => true,
+      'lowercase false' =>false,
+      'uppercase TRUE' =>TRUE,
+      'uppercase FALSE' =>FALSE,
+
+      // empty data
+      'empty string DQ' => "",
+      'empty string SQ' => '',
+
+      // object data
+      'instance of classWithToString' => new classWithToString(),
+      'instance of classWithoutToString' => new classWithoutToString(),
+
+      // undefined data
+      'undefined var' => @$undefined_var,
+
+      // unset data
+      'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for method_name
+
+foreach($inputs as $key =>$value) {
+      echo "\n--$key--\n";
+      var_dump( get_class_vars($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_class_vars() : usage variation ***
+
+--int 0--
+bool(false)
+
+--int 1--
+bool(false)
+
+--int 12345--
+bool(false)
+
+--int -12345--
+bool(false)
+
+--float 10.5--
+bool(false)
+
+--float -10.5--
+bool(false)
+
+--float 12.3456789000e10--
+bool(false)
+
+--float -12.3456789000e10--
+bool(false)
+
+--float .5--
+bool(false)
+
+--empty array--
+
+Warning: get_class_vars() expects parameter 1 to be string (Unicode or 
binary), array given in %sget_class_vars_variation1.php on line %d
+NULL
+
+--int indexed array--
+
+Warning: get_class_vars() expects parameter 1 to be string (Unicode or 
binary), array given in %sget_class_vars_variation1.php on line %d
+NULL
+
+--associative array--
+
+Warning: get_class_vars() expects parameter 1 to be string (Unicode or 
binary), array given in %sget_class_vars_variation1.php on line %d
+NULL
+
+--nested arrays--
+
+Warning: get_class_vars() expects parameter 1 to be string (Unicode or 
binary), array given in %sget_class_vars_variation1.php on line %d
+NULL
+
+--uppercase NULL--
+bool(false)
+
+--lowercase null--
+bool(false)
+
+--lowercase true--
+bool(false)
+
+--lowercase false--
+bool(false)
+
+--uppercase TRUE--
+bool(false)
+
+--uppercase FALSE--
+bool(false)
+
+--empty string DQ--
+bool(false)
+
+--empty string SQ--
+bool(false)
+
+--instance of classWithToString--
+bool(false)
+
+--instance of classWithoutToString--
+
+Warning: get_class_vars() expects parameter 1 to be string (Unicode or 
binary), object given in %sget_class_vars_variation1.php on line %d
+NULL
+
+--undefined var--
+bool(false)
+
+--unset var--
+bool(false)
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/interface_exists_variation2.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/class_object/interface_exists_variation2.phpt
diff -u /dev/null 
php-src/ext/standard/tests/class_object/interface_exists_variation2.phpt:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ php-src/ext/standard/tests/class_object/interface_exists_variation2.phpt    
Tue Jun 16 08:59:42 2009
@@ -0,0 +1,204 @@
+--TEST--
+Test interface_exists() function : usage variation 
+--FILE--
+<?php
+/* Prototype  : bool interface_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists 
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing interface_exists() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$classname = 'aBogusInterfaceName';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+       public function __toString() {
+               return "Class A object";
+       }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+      // int data
+      'int 0' => 0,
+      'int 1' => 1,
+      'int 12345' => 12345,
+      'int -12345' => -2345,
+
+      // float data
+      'float 10.5' => 10.5,
+      'float -10.5' => -10.5,
+      'float 12.3456789000e10' => 12.3456789000e10,
+      'float -12.3456789000e10' => -12.3456789000e10,
+      'float .5' => .5,
+
+      // array data
+      'empty array' => array(),
+      'int indexed array' => $index_array,
+      'associative array' => $assoc_array,
+      'nested arrays' => array('foo', $index_array, $assoc_array),
+
+      // null data
+      'uppercase NULL' => NULL,
+      'lowercase null' => null,
+
+      // boolean data
+      'lowercase true' => true,
+      'lowercase false' =>false,
+      'uppercase TRUE' =>TRUE,
+      'uppercase FALSE' =>FALSE,
+
+      // empty data
+      'empty string DQ' => "",
+      'empty string SQ' => '',
+
+      // string data
+      'string DQ' => "string",
+      'string SQ' => 'string',
+      'mixed case string' => "sTrInG",
+      'heredoc' => $heredoc,
+
+      // object data
+      'instance of classWithToString' => new classWithToString(),
+      'instance of classWithoutToString' => new classWithoutToString(),
+
+      // undefined data
+      'undefined var' => @$undefined_var,
+
+      // unset data
+      'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for autoload
+
+foreach($inputs as $key =>$value) {
+      echo "\n--$key--\n";
+      var_dump( interface_exists($classname, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing interface_exists() : usage variation ***
+
+--int 0--
+bool(false)
+
+--int 1--
+bool(false)
+
+--int 12345--
+bool(false)
+
+--int -12345--
+bool(false)
+
+--float 10.5--
+bool(false)
+
+--float -10.5--
+bool(false)
+
+--float 12.3456789000e10--
+bool(false)
+
+--float -12.3456789000e10--
+bool(false)
+
+--float .5--
+bool(false)
+
+--empty array--
+
+Warning: interface_exists() expects parameter 2 to be boolean, array given in 
%sinterface_exists_variation2.php on line %d
+NULL
+
+--int indexed array--
+
+Warning: interface_exists() expects parameter 2 to be boolean, array given in 
%sinterface_exists_variation2.php on line %d
+NULL
+
+--associative array--
+
+Warning: interface_exists() expects parameter 2 to be boolean, array given in 
%sinterface_exists_variation2.php on line %d
+NULL
+
+--nested arrays--
+
+Warning: interface_exists() expects parameter 2 to be boolean, array given in 
%sinterface_exists_variation2.php on line %d
+NULL
+
+--uppercase NULL--
+bool(false)
+
+--lowercase null--
+bool(false)
+
+--lowercase true--
+bool(false)
+
+--lowercase false--
+bool(false)
+
+--uppercase TRUE--
+bool(false)
+
+--uppercase FALSE--
+bool(false)
+
+--empty string DQ--
+bool(false)
+
+--empty string SQ--
+bool(false)
+
+--string DQ--
+bool(false)
+
+--string SQ--
+bool(false)
+
+--mixed case string--
+bool(false)
+
+--heredoc--
+bool(false)
+
+--instance of classWithToString--
+
+Warning: interface_exists() expects parameter 2 to be boolean, object given in 
%sinterface_exists_variation2.php on line %d
+NULL
+
+--instance of classWithoutToString--
+
+Warning: interface_exists() expects parameter 2 to be boolean, object given in 
%sinterface_exists_variation2.php on line %d
+NULL
+
+--undefined var--
+bool(false)
+
+--unset var--
+bool(false)
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/get_class_vars_variation2.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/class_object/get_class_vars_variation2.phpt
diff -u /dev/null 
php-src/ext/standard/tests/class_object/get_class_vars_variation2.phpt:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ php-src/ext/standard/tests/class_object/get_class_vars_variation2.phpt      
Tue Jun 16 08:59:42 2009
@@ -0,0 +1,168 @@
+--TEST--
+Test get_class_vars() function : testing visibility 
+--FILE--
+<?php
+/* Prototype  : array get_class_vars(string class_name)
+ * Description: Returns an array of default properties of the class. 
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions: 
+ */
+
+class Ancestor {
+  function test() {
+    var_dump(get_class_vars("Tester"));
+  }
+  
+  static function testStatic() {
+    var_dump(get_class_vars("Tester"));
+  }
+}
+
+class Tester extends Ancestor {
+  public $pub = "public var";
+  protected $prot = "protected var";
+  private $priv = "private var";
+  
+  static public $pubs = "public static var";
+  static protected $prots = "protected static var";
+  static private $privs = "private static var";
+  
+  function test() {
+    var_dump(get_class_vars("Tester"));
+  }
+  
+  static function testStatic() {
+    var_dump(get_class_vars("Tester"));
+  }
+}
+
+class Child extends Tester {
+  function test() {
+    var_dump(get_class_vars("Tester"));
+  }
+  
+  static function testStatic() {
+    var_dump(get_class_vars("Tester"));
+  }
+}
+
+echo "*** Testing get_class_vars() : testing visibility\n";
+
+echo "\n-- From global context --\n";
+var_dump(get_class_vars("Tester"));
+
+echo "\n-- From inside an object instance --\n";
+$instance = new Tester();
+$instance->test();
+
+echo "\n-- From  a static context --\n";
+Tester::testStatic();
+
+
+echo "\n-- From inside an  parent object instance --\n";
+$parent = new Ancestor();
+$parent->test();
+
+echo "\n-- From a parents static context --\n";
+Ancestor::testStatic();
+
+
+echo "\n-- From inside a child object instance --\n";
+$child = new Child();
+$child->test();
+
+echo "\n-- From a child's static context --\n";
+Child::testStatic();
+?>
+===DONE===
+--EXPECT--
+*** Testing get_class_vars() : testing visibility
+
+-- From global context --
+array(2) {
+  [u"pub"]=>
+  unicode(10) "public var"
+  [u"pubs"]=>
+  unicode(17) "public static var"
+}
+
+-- From inside an object instance --
+array(6) {
+  [u"pub"]=>
+  unicode(10) "public var"
+  [u"prot"]=>
+  unicode(13) "protected var"
+  [u"priv"]=>
+  unicode(11) "private var"
+  [u"pubs"]=>
+  unicode(17) "public static var"
+  [u"prots"]=>
+  unicode(20) "protected static var"
+  [u"privs"]=>
+  unicode(18) "private static var"
+}
+
+-- From  a static context --
+array(6) {
+  [u"pub"]=>
+  unicode(10) "public var"
+  [u"prot"]=>
+  unicode(13) "protected var"
+  [u"priv"]=>
+  unicode(11) "private var"
+  [u"pubs"]=>
+  unicode(17) "public static var"
+  [u"prots"]=>
+  unicode(20) "protected static var"
+  [u"privs"]=>
+  unicode(18) "private static var"
+}
+
+-- From inside an  parent object instance --
+array(4) {
+  [u"pub"]=>
+  unicode(10) "public var"
+  [u"prot"]=>
+  unicode(13) "protected var"
+  [u"pubs"]=>
+  unicode(17) "public static var"
+  [u"prots"]=>
+  unicode(20) "protected static var"
+}
+
+-- From a parents static context --
+array(4) {
+  [u"pub"]=>
+  unicode(10) "public var"
+  [u"prot"]=>
+  unicode(13) "protected var"
+  [u"pubs"]=>
+  unicode(17) "public static var"
+  [u"prots"]=>
+  unicode(20) "protected static var"
+}
+
+-- From inside a child object instance --
+array(4) {
+  [u"pub"]=>
+  unicode(10) "public var"
+  [u"prot"]=>
+  unicode(13) "protected var"
+  [u"pubs"]=>
+  unicode(17) "public static var"
+  [u"prots"]=>
+  unicode(20) "protected static var"
+}
+
+-- From a child's static context --
+array(4) {
+  [u"pub"]=>
+  unicode(10) "public var"
+  [u"prot"]=>
+  unicode(13) "protected var"
+  [u"pubs"]=>
+  unicode(17) "public static var"
+  [u"prots"]=>
+  unicode(20) "protected static var"
+}
+===DONE===
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/property_exists_error.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/class_object/property_exists_error.phpt
diff -u /dev/null 
php-src/ext/standard/tests/class_object/property_exists_error.phpt:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ php-src/ext/standard/tests/class_object/property_exists_error.phpt  Tue Jun 
16 08:59:42 2009
@@ -0,0 +1,47 @@
+--TEST--
+Test property_exists() function : error conditions 
+--FILE--
+<?php
+/* Prototype  : bool property_exists(mixed object_or_class, string 
property_name)
+ * Description: Checks if the object or class has a property 
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions: 
+ */
+
+echo "*** Testing property_exists() : error conditions ***\n";
+
+$object_or_class = "obj";
+$property_name = 'string_val';
+$extra_arg = 10;
+
+
+echo "\n-- Testing property_exists() function with more than expected no. of 
arguments --\n";
+var_dump( property_exists($object_or_class, $property_name, $extra_arg) );
+
+
+echo "\n-- Testing property_exists() function with less than expected no. of 
arguments --\n";
+var_dump( property_exists($object_or_class) );
+
+echo "\n-- Testing property_exists() function with incorrect arguments --\n";
+var_dump( property_exists(10, $property_name) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing property_exists() : error conditions ***
+
+-- Testing property_exists() function with more than expected no. of arguments 
--
+
+Warning: property_exists() expects exactly 2 parameters, 3 given in 
%sproperty_exists_error.php on line %d
+NULL
+
+-- Testing property_exists() function with less than expected no. of arguments 
--
+
+Warning: property_exists() expects exactly 2 parameters, 1 given in 
%sproperty_exists_error.php on line %d
+NULL
+
+-- Testing property_exists() function with incorrect arguments --
+
+Warning: First parameter must either be an object or the name of an existing 
class in %sproperty_exists_error.php on line %d
+NULL
+===DONE===
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt?r1=1.1&r2=1.2&diff_format=u
Index: 
php-src/ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt
diff -u /dev/null 
php-src/ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ 
php-src/ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt 
    Tue Jun 16 08:59:42 2009
@@ -0,0 +1,37 @@
+--TEST--
+Test get_declared_interfaces() function : autoloading of interfaces
+--FILE--
+<?php
+/* Prototype  : proto array get_declared_interfaces()
+ * Description: Returns an array of all declared interfaces. 
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions: 
+ */
+
+
+echo "*** Testing get_declared_interfaces() : autoloading of interfaces ***\n";
+
+function __autoload($class_name) {
+    require_once $class_name . '.inc';
+}
+
+echo "\n-- before interface is used --\n";
+var_dump(in_array('AutoInterface', get_declared_interfaces()));
+
+
+echo "\n-- after interface is used --\n";
+class Implementor implements AutoInterface {}
+var_dump(in_array('AutoInterface', get_declared_interfaces()));
+
+echo "\nDONE\n";
+?>
+--EXPECTF--
+*** Testing get_declared_interfaces() : autoloading of interfaces ***
+
+-- before interface is used --
+bool(false)
+
+-- after interface is used --
+bool(true)
+
+DONE
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/class_object/get_class_vars_error.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/class_object/get_class_vars_error.phpt
diff -u /dev/null 
php-src/ext/standard/tests/class_object/get_class_vars_error.phpt:1.2
--- /dev/null   Tue Jun 16 08:59:42 2009
+++ php-src/ext/standard/tests/class_object/get_class_vars_error.phpt   Tue Jun 
16 08:59:42 2009
@@ -0,0 +1,38 @@
+--TEST--
+Test get_class_vars() function : error conditions
+--FILE--
+<?php
+/* Prototype  : array get_class_vars(string class_name)
+ * Description: Returns an array of default properties of the class.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_class_vars() : error conditions ***\n";
+
+
+//Test get_class_vars with one more than the expected number of arguments
+echo "\n-- Testing get_class_vars() function with more than expected no. of 
arguments --\n";
+$obj = new stdclass();
+$extra_arg = 10;
+var_dump(get_class_vars($obj,$extra_arg) );
+
+// Testing get_class_vars with one less than the expected number of arguments
+echo "\n-- Testing get_class_vars() function with less than expected no. of 
arguments --\n";
+var_dump(get_class_vars());
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_class_vars() : error conditions ***
+
+-- Testing get_class_vars() function with more than expected no. of arguments 
--
+
+Warning: get_class_vars() expects exactly 1 parameter, 2 given in 
%sget_class_vars_error.php on line %d
+NULL
+
+-- Testing get_class_vars() function with less than expected no. of arguments 
--
+
+Warning: get_class_vars() expects exactly 1 parameter, 0 given in 
%sget_class_vars_error.php on line %d
+NULL
+===DONE===
\ No newline at end of file

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to