Annotation of embedaddon/php/ext/posix/tests/posix_getpgid_variation.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test posix_getpgid() function : variation 
                      3: --SKIPIF--
                      4: <?php 
                      5: if((!extension_loaded("posix")) || (!function_exists("posix_getpgid"))) {
                      6:         print "skip - POSIX extension not loaded or posix_getpgid() does not exist";
                      7: } 
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: /* Prototype  : proto int posix_getpgid(void)
                     12:  * Description: Get the process group id of the specified process (This is not a POSIX function, but a SVR4ism, so we compile conditionally) 
                     13:  * Source code: ext/posix/posix.c
                     14:  * Alias to functions: 
                     15:  */
                     16: 
                     17: echo "*** Testing posix_getpgid() : usage variations ***\n";
                     18: 
                     19: // Initialise function arguments not being substituted (if any)
                     20: 
                     21: //get an unset variable
                     22: $unset_var = 10;
                     23: unset ($unset_var);
                     24: 
                     25: //array of values to iterate over
                     26: $values = array(
                     27: 
                     28:       // float data
                     29:       10.5,
                     30:       -10.5,
                     31:       10.1234567e10,
                     32:       10.7654321E-10,
                     33:       .5,
                     34: 
                     35:       // array data
                     36:       array(),
                     37:       array(0),
                     38:       array(1),
                     39:       array(1, 2),
                     40:       array('color' => 'red', 'item' => 'pen'),
                     41: 
                     42:       // null data
                     43:       NULL,
                     44:       null,
                     45: 
                     46:       // boolean data
                     47:       true,
                     48:       false,
                     49:       TRUE,
                     50:       FALSE,
                     51: 
                     52:       // empty data
                     53:       "",
                     54:       '',
                     55: 
                     56:       // string data
                     57:       "string",
                     58:       'string',
                     59: 
                     60:       // undefined data
                     61:       $undefined_var,
                     62: 
                     63:       // unset data
                     64:       $unset_var,
                     65:       
                     66:       // object data
                     67:       new stdclass(),
                     68: );
                     69: 
                     70: // loop through each element of the array for gid
                     71: 
                     72: foreach($values as $value) {
                     73:       echo "\nArg value $value \n";
                     74:       $result = posix_getpgid($value);
                     75:       if (is_int($result) || $result === false) {
                     76:           echo "valid output\n";
                     77:       } else {
                     78:           var_dump($result);
                     79:       }
                     80: };
                     81: 
                     82: echo "Done";
                     83: ?>
                     84: --EXPECTF--
                     85: *** Testing posix_getpgid() : usage variations ***
                     86: 
                     87: Notice: Undefined variable: undefined_var in %s on line %d
                     88: 
                     89: Notice: Undefined variable: unset_var in %s on line %d
                     90: 
                     91: Arg value 10.5 
                     92: valid output
                     93: 
                     94: Arg value -10.5 
                     95: valid output
                     96: 
                     97: Arg value 101234567000 
                     98: valid output
                     99: 
                    100: Arg value 1.07654321E-9 
                    101: valid output
                    102: 
                    103: Arg value 0.5 
                    104: valid output
                    105: 
1.1.1.2 ! misho     106: Notice: Array to string conversion in %sposix_getpgid_variation.php on line %d
        !           107: 
1.1       misho     108: Arg value Array 
                    109: 
                    110: Warning: posix_getpgid() expects parameter 1 to be long, array given in %s on line %d
                    111: valid output
                    112: 
1.1.1.2 ! misho     113: Notice: Array to string conversion in %sposix_getpgid_variation.php on line %d
        !           114: 
1.1       misho     115: Arg value Array 
                    116: 
                    117: Warning: posix_getpgid() expects parameter 1 to be long, array given in %s on line %d
                    118: valid output
                    119: 
1.1.1.2 ! misho     120: Notice: Array to string conversion in %sposix_getpgid_variation.php on line %d
        !           121: 
1.1       misho     122: Arg value Array 
                    123: 
                    124: Warning: posix_getpgid() expects parameter 1 to be long, array given in %s on line %d
                    125: valid output
                    126: 
1.1.1.2 ! misho     127: Notice: Array to string conversion in %sposix_getpgid_variation.php on line %d
        !           128: 
1.1       misho     129: Arg value Array 
                    130: 
                    131: Warning: posix_getpgid() expects parameter 1 to be long, array given in %s on line %d
                    132: valid output
                    133: 
1.1.1.2 ! misho     134: Notice: Array to string conversion in %sposix_getpgid_variation.php on line %d
        !           135: 
1.1       misho     136: Arg value Array 
                    137: 
                    138: Warning: posix_getpgid() expects parameter 1 to be long, array given in %s on line %d
                    139: valid output
                    140: 
                    141: Arg value  
                    142: valid output
                    143: 
                    144: Arg value  
                    145: valid output
                    146: 
                    147: Arg value 1 
                    148: valid output
                    149: 
                    150: Arg value  
                    151: valid output
                    152: 
                    153: Arg value 1 
                    154: valid output
                    155: 
                    156: Arg value  
                    157: valid output
                    158: 
                    159: Arg value  
                    160: 
                    161: Warning: posix_getpgid() expects parameter 1 to be long, string given in %s on line %d
                    162: valid output
                    163: 
                    164: Arg value  
                    165: 
                    166: Warning: posix_getpgid() expects parameter 1 to be long, string given in %s on line %d
                    167: valid output
                    168: 
                    169: Arg value string 
                    170: 
                    171: Warning: posix_getpgid() expects parameter 1 to be long, string given in %s on line %d
                    172: valid output
                    173: 
                    174: Arg value string 
                    175: 
                    176: Warning: posix_getpgid() expects parameter 1 to be long, string given in %s on line %d
                    177: valid output
                    178: 
                    179: Arg value  
                    180: valid output
                    181: 
                    182: Arg value  
                    183: valid output
                    184: 
                    185: Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d

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