Annotation of embedaddon/php/ext/gd/tests/imagecolorstotal_error.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test imagecolorstotal() function : error conditions  - Pass incorrect number of arguments
                      3: --SKIPIF--
                      4: <?php
                      5: if(!extension_loaded('gd')) {
                      6:     die('skip gd extension is not loaded');
                      7: }
                      8: if(!function_exists('imagecolorstotal')) {
                      9:     die('skip imagecolorstotal function is not available');
                     10: }
                     11: ?> 
                     12: --FILE--
                     13: <?php
                     14: /* Prototype  : int imagecolorstotal  ( resource $image  )
                     15:  * Description: Find out the number of colors in an image's palette
                     16:  * Source code: ext/gd/gd.c
                     17:  */
                     18: 
                     19: echo "*** Testing imagecolorstotal() : error conditions ***\n";
                     20: 
                     21: // Get a resource
                     22: $im = fopen(__FILE__, 'r');
                     23: 
                     24: echo "\n-- Testing imagecolorstotal() function with Zero arguments --\n";
                     25: var_dump( imagecolorstotal() );
                     26: 
                     27: echo "\n-- Testing imagecolorstotal() function with more than expected no. of arguments --\n";
                     28: $extra_arg = false;
                     29: var_dump( imagecolorstotal($im, $extra_arg) );
                     30: 
                     31: echo "\n-- Testing imagecolorstotal() function with a invalid resource\n";
                     32: var_dump( imagecolorstotal($im) );
                     33: 
                     34: fclose($im); 
                     35: ?>
                     36: ===DONE===
                     37: --EXPECTF--
                     38: *** Testing imagecolorstotal() : error conditions ***
                     39: 
                     40: -- Testing imagecolorstotal() function with Zero arguments --
                     41: 
                     42: Warning: imagecolorstotal() expects exactly 1 parameter, 0 given in %s on line %d
                     43: NULL
                     44: 
                     45: -- Testing imagecolorstotal() function with more than expected no. of arguments --
                     46: 
                     47: Warning: imagecolorstotal() expects exactly 1 parameter, 2 given in %s on line %d
                     48: NULL
                     49: 
                     50: -- Testing imagecolorstotal() function with a invalid resource
                     51: 
                     52: Warning: imagecolorstotal(): supplied resource is not a valid Image resource in %s on line %d
                     53: bool(false)
                     54: ===DONE===

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