summaryrefslogtreecommitdiff
path: root/ext/gd/tests/imagecolorstotal_error.phpt
blob: e05c6894dbf15db0a39bef408e1a56f68caa5833 (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
--TEST--
Test imagecolorstotal() function : error conditions - Pass invalid resource type
--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 a invalid resource\n";
try {
    var_dump( imagecolorstotal($im) );
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}

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

-- Testing imagecolorstotal() function with a invalid resource
imagecolorstotal(): supplied resource is not a valid Image resource
===DONE===