~ubuntu-branches/ubuntu/quantal/php5/quantal

« back to all changes in this revision

Viewing changes to ext/standard/tests/array/array_product_error.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Sean Finney
  • Date: 2009-07-01 09:12:10 UTC
  • mto: (0.9.1) (1.1.17 upstream)
  • mto: This revision was merged to the branch mainline in revision 58.
  • Revision ID: james.westby@ubuntu.com-20090701091210-go0h6506p62on17r
Tags: upstream-5.3.0
ImportĀ upstreamĀ versionĀ 5.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
Test array_product() function : error conditions 
 
3
--FILE--
 
4
<?php
 
5
/* Prototype  : mixed array_product(array input)
 
6
 * Description: Returns the product of the array entries 
 
7
 * Source code: ext/standard/array.c
 
8
 * Alias to functions: 
 
9
 */
 
10
 
 
11
echo "*** Testing array_product() : error conditions ***\n";
 
12
 
 
13
// Zero arguments
 
14
echo "\n-- Testing array_product() function with Zero arguments --\n";
 
15
var_dump( array_product() );
 
16
 
 
17
//Test array_product with one more than the expected number of arguments
 
18
echo "\n-- Testing array_product() function with more than expected no. of arguments --\n";
 
19
$input = array(1, 2);
 
20
$extra_arg = 10;
 
21
var_dump( array_product($input, $extra_arg) );
 
22
 
 
23
echo "\n-- Testing array_product() function incorrect argument type --\n";
 
24
var_dump( array_product("bob") );
 
25
 
 
26
?>
 
27
===DONE===
 
28
--EXPECTF--
 
29
*** Testing array_product() : error conditions ***
 
30
 
 
31
-- Testing array_product() function with Zero arguments --
 
32
 
 
33
Warning: array_product() expects exactly 1 parameter, 0 given in %sarray_product_error.php on line %d
 
34
NULL
 
35
 
 
36
-- Testing array_product() function with more than expected no. of arguments --
 
37
 
 
38
Warning: array_product() expects exactly 1 parameter, 2 given in %sarray_product_error.php on line %d
 
39
NULL
 
40
 
 
41
-- Testing array_product() function incorrect argument type --
 
42
 
 
43
Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_error.php on line %d
 
44
NULL
 
45
===DONE===