Annotation of embedaddon/php/ext/date/tests/date_modify_error.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test date_modify() function : error conditions 
        !             3: --FILE--
        !             4: <?php
        !             5: /* Prototype  : DateTime date_modify  ( DateTime $object  , string $modify  )
        !             6:  * Description: Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime(). 
        !             7:  * Source code: ext/date/php_date.c
        !             8:  * Alias to functions: public DateTime DateTime::modify()
        !             9:  */
        !            10: 
        !            11: //Set the default time zone 
        !            12: date_default_timezone_set("Europe/London");
        !            13: 
        !            14: echo "*** Testing date_modify() : error conditions ***\n";
        !            15: 
        !            16: echo "\n-- Testing date_modify() function with zero arguments --\n";
        !            17: var_dump( date_modify() );
        !            18: 
        !            19: // Create a date object
        !            20: $datetime = date_create("2009-01-30 19:34:10");
        !            21: 
        !            22: echo "\n-- Testing date_modify() function with less than expected no. of arguments --\n";
        !            23: var_dump( date_modify($datetime) );
        !            24: 
        !            25: echo "\n-- Testing date_modify() function with more than expected no. of arguments --\n";
        !            26: $modify = "+1 day";
        !            27: $extra_arg = 99;
        !            28: var_dump( date_modify($datetime, $modify, $extra_arg) );
        !            29: 
        !            30: echo "\n-- Testing date_modify() function with an invalid values for \$object argument --\n";
        !            31: $invalid_obj = new stdClass();
        !            32: var_dump( date_modify($invalid_obj, $modify) );  
        !            33: $invalid_obj = 10;
        !            34: var_dump( date_modify($invalid_obj, $modify) );
        !            35: $invalid_obj = null;
        !            36: var_dump( date_modify($invalid_obj, $modify) );  
        !            37: 
        !            38: ?>
        !            39: ===DONE===
        !            40: --EXPECTF--
        !            41: *** Testing date_modify() : error conditions ***
        !            42: 
        !            43: -- Testing date_modify() function with zero arguments --
        !            44: 
        !            45: Warning: date_modify() expects exactly 2 parameters, 0 given in %s on line %d
        !            46: bool(false)
        !            47: 
        !            48: -- Testing date_modify() function with less than expected no. of arguments --
        !            49: 
        !            50: Warning: date_modify() expects exactly 2 parameters, 1 given in %s on line %d
        !            51: bool(false)
        !            52: 
        !            53: -- Testing date_modify() function with more than expected no. of arguments --
        !            54: 
        !            55: Warning: date_modify() expects exactly 2 parameters, 3 given in %s on line %d
        !            56: bool(false)
        !            57: 
        !            58: -- Testing date_modify() function with an invalid values for $object argument --
        !            59: 
        !            60: Warning: date_modify() expects parameter 1 to be DateTime, object given in %s on line %d
        !            61: bool(false)
        !            62: 
        !            63: Warning: date_modify() expects parameter 1 to be DateTime, integer given in %s on line %d
        !            64: bool(false)
        !            65: 
        !            66: Warning: date_modify() expects parameter 1 to be DateTime, null given in %s on line %d
        !            67: bool(false)
        !            68: ===DONE===

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