summaryrefslogtreecommitdiff
path: root/ext/gd/tests/imagecolorstotal_error.phpt
blob: 59999423ca56c00c0473cb98e5e9f116c5536014 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--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===