Annotation of embedaddon/php/ext/standard/tests/strings/strrev_variation4.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test strrev() function : usage variations - unexpected inputs
        !             3: --FILE--
        !             4: <?php
        !             5: /* Prototype  : string strrev(string $str);
        !             6:  * Description: Reverse a string 
        !             7:  * Source code: ext/standard/string.c
        !             8: */
        !             9: 
        !            10: /* Testing strrev() function with unexpected inputs for 'str' */
        !            11: 
        !            12: echo "*** Testing strrev() : unexpected inputs for 'str' ***\n";
        !            13: //class declaration
        !            14: class sample {
        !            15:   public function __toString(){
        !            16:     return "object";
        !            17:   }
        !            18: }
        !            19: 
        !            20: //get the resource 
        !            21: $resource = fopen(__FILE__, "r");
        !            22: 
        !            23: //get an unset variable
        !            24: $unset_var = 10;
        !            25: unset ($unset_var);
        !            26: 
        !            27: //array of values to iterate over
        !            28: $values = array(
        !            29: 
        !            30:   // int data
        !            31:   0,
        !            32:   1,
        !            33:   12345,
        !            34:   -2345,
        !            35: 
        !            36:   // float data
        !            37:   10.5,
        !            38:    -10.5,
        !            39:   10.5e10,
        !            40:   10.6E-10,
        !            41:   .5,
        !            42: 
        !            43:   // array data
        !            44:   array(),
        !            45:   array(0),
        !            46:   array(1),
        !            47:   array(1, 2),
        !            48:   array('color' => 'red', 'item' => 'pen'),
        !            49: 
        !            50:   // null data
        !            51:   NULL,
        !            52:   null,
        !            53: 
        !            54:   // boolean data
        !            55:   true,
        !            56:   false,
        !            57:   TRUE,
        !            58:   FALSE,
        !            59: 
        !            60:   // empty data
        !            61:   "",
        !            62:   '',
        !            63: 
        !            64:   // object data
        !            65:   new sample(),
        !            66: 
        !            67:   // resource
        !            68:   $resource,
        !            69: 
        !            70:   // undefined data
        !            71:   @$undefined_var,
        !            72: 
        !            73:   // unset data
        !            74:   @$unset_var
        !            75: );
        !            76: 
        !            77: // loop through each element of the array for str
        !            78: 
        !            79: $count = 1;
        !            80: foreach($values as $value) {
        !            81:   echo "\n-- Iterator $count --\n";
        !            82:   var_dump( strrev($value) );
        !            83:   $count++;
        !            84: };
        !            85: 
        !            86: fclose($resource);  //closing the file handle
        !            87: 
        !            88: echo "*** Done ***";
        !            89: ?>
        !            90: --EXPECTF--
        !            91: *** Testing strrev() : unexpected inputs for 'str' ***
        !            92: 
        !            93: -- Iterator 1 --
        !            94: string(1) "0"
        !            95: 
        !            96: -- Iterator 2 --
        !            97: string(1) "1"
        !            98: 
        !            99: -- Iterator 3 --
        !           100: string(5) "54321"
        !           101: 
        !           102: -- Iterator 4 --
        !           103: string(5) "5432-"
        !           104: 
        !           105: -- Iterator 5 --
        !           106: string(4) "5.01"
        !           107: 
        !           108: -- Iterator 6 --
        !           109: string(5) "5.01-"
        !           110: 
        !           111: -- Iterator 7 --
        !           112: string(12) "000000000501"
        !           113: 
        !           114: -- Iterator 8 --
        !           115: string(7) "9-E60.1"
        !           116: 
        !           117: -- Iterator 9 --
        !           118: string(3) "5.0"
        !           119: 
        !           120: -- Iterator 10 --
        !           121: 
        !           122: Warning: strrev() expects parameter 1 to be string, array given in %s on line %d
        !           123: NULL
        !           124: 
        !           125: -- Iterator 11 --
        !           126: 
        !           127: Warning: strrev() expects parameter 1 to be string, array given in %s on line %d
        !           128: NULL
        !           129: 
        !           130: -- Iterator 12 --
        !           131: 
        !           132: Warning: strrev() expects parameter 1 to be string, array given in %s on line %d
        !           133: NULL
        !           134: 
        !           135: -- Iterator 13 --
        !           136: 
        !           137: Warning: strrev() expects parameter 1 to be string, array given in %s on line %d
        !           138: NULL
        !           139: 
        !           140: -- Iterator 14 --
        !           141: 
        !           142: Warning: strrev() expects parameter 1 to be string, array given in %s on line %d
        !           143: NULL
        !           144: 
        !           145: -- Iterator 15 --
        !           146: string(0) ""
        !           147: 
        !           148: -- Iterator 16 --
        !           149: string(0) ""
        !           150: 
        !           151: -- Iterator 17 --
        !           152: string(1) "1"
        !           153: 
        !           154: -- Iterator 18 --
        !           155: string(0) ""
        !           156: 
        !           157: -- Iterator 19 --
        !           158: string(1) "1"
        !           159: 
        !           160: -- Iterator 20 --
        !           161: string(0) ""
        !           162: 
        !           163: -- Iterator 21 --
        !           164: string(0) ""
        !           165: 
        !           166: -- Iterator 22 --
        !           167: string(0) ""
        !           168: 
        !           169: -- Iterator 23 --
        !           170: string(6) "tcejbo"
        !           171: 
        !           172: -- Iterator 24 --
        !           173: 
        !           174: Warning: strrev() expects parameter 1 to be string, resource given in %s on line %d
        !           175: NULL
        !           176: 
        !           177: -- Iterator 25 --
        !           178: string(0) ""
        !           179: 
        !           180: -- Iterator 26 --
        !           181: string(0) ""
        !           182: *** Done ***

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