File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / gd / tests / imagecolorstotal_error.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:56 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Test imagecolorstotal() function : error conditions  - Pass incorrect number of arguments
--SKIPIF--
<?php
if(!extension_loaded('gd')) {
    die('skip gd extension is not loaded');
}
if(!function_exists('imagecolorstotal')) {
    die('skip imagecolorstotal function is not available');
}
?> 
--FILE--
<?php
/* Prototype  : int imagecolorstotal  ( resource $image  )
 * Description: Find out the number of colors in an image's palette
 * Source code: ext/gd/gd.c
 */

echo "*** Testing imagecolorstotal() : error conditions ***\n";

// Get a resource
$im = fopen(__FILE__, 'r');

echo "\n-- Testing imagecolorstotal() function with Zero arguments --\n";
var_dump( imagecolorstotal() );

echo "\n-- Testing imagecolorstotal() function with more than expected no. of arguments --\n";
$extra_arg = false;
var_dump( imagecolorstotal($im, $extra_arg) );

echo "\n-- Testing imagecolorstotal() function with a invalid resource\n";
var_dump( imagecolorstotal($im) );

fclose($im); 
?>
===DONE===
--EXPECTF--
*** Testing imagecolorstotal() : error conditions ***

-- Testing imagecolorstotal() function with Zero arguments --

Warning: imagecolorstotal() expects exactly 1 parameter, 0 given in %s on line %d
NULL

-- Testing imagecolorstotal() function with more than expected no. of arguments --

Warning: imagecolorstotal() expects exactly 1 parameter, 2 given in %s on line %d
NULL

-- Testing imagecolorstotal() function with a invalid resource

Warning: imagecolorstotal(): supplied resource is not a valid Image resource in %s on line %d
bool(false)
===DONE===

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