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 ="\"";
17var_dump( $fo->fputcsv($fields, $delim, $enclosure, $fo) );
18
19echo "Done\n";
20--CLEAN--
21<?php
22$file = __DIR__ . '/SplFileObject_fputcsv.csv';
23unlink($file);
24?>
25--EXPECTF--
26*** Testing error conditions ***
27-- Testing fputcsv() with zero argument --
28
29Warning: SplFileObject::fputcsv() expects at least 1 parameter, 0 given in %s on line %d
30NULL
31-- Testing fputcsv() with more than expected number of arguments --
32
33Warning: SplFileObject::fputcsv() expects at most 3 parameters, 4 given in %s on line %d
34NULL
35Done
36