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