1--TEST--
2SplFileObject::fputcsv(): error conditions
3--FILE--
4<?php
5$fo = new SplFileObject(__DIR__ . '/SplFileObject_fputcsv.csv', 'w');
6
7echo "*** Testing error conditions ***\n";
8// zero argument
9echo "-- Testing fputcsv() with zero argument --\n";
10var_dump( $fo->fputcsv() );
11
12// more than expected no. of args
13echo "-- Testing fputcsv() with more than expected number of arguments --\n";
14$fields = array("fld1", "fld2");
15$delim = ";";
16$enclosure ="\"";
17$escape = "\\";
18var_dump( $fo->fputcsv($fields, $delim, $enclosure, $escape, $fo) );
19
20echo "Done\n";
21--CLEAN--
22<?php
23$file = __DIR__ . '/SplFileObject_fputcsv.csv';
24unlink($file);
25?>
26--EXPECTF--
27*** Testing error conditions ***
28-- Testing fputcsv() with zero argument --
29
30Warning: SplFileObject::fputcsv() expects at least 1 parameter, 0 given in %s on line %d
31NULL
32-- Testing fputcsv() with more than expected number of arguments --
33
34Warning: SplFileObject::fputcsv() expects at most 4 parameters, 5 given in %s on line %d
35NULL
36Done
37