mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Made some SplFileObject::fputcsv not pollute the working dir.
This commit is contained in:
parent
09e367dbaf
commit
54f0d50d3e
@ -2,7 +2,7 @@
|
||||
SplFileObject::fputcsv(): Checking data after calling the function
|
||||
--FILE--
|
||||
<?php
|
||||
$fo = new SplFileObject('SplFileObject_fputcsv.csv', 'w');
|
||||
$fo = new SplFileObject(__DIR__ . '/SplFileObject_fputcsv.csv', 'w');
|
||||
|
||||
$data = array(1, 2, 'foo', 'haha', array(4, 5, 6), 1.3, null);
|
||||
|
||||
@ -12,7 +12,8 @@ var_dump($data);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink('SplFileObject::fputcsv.csv');
|
||||
$file = __DIR__ . '/SplFileObject_fputcsv.csv';
|
||||
unlink($file);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
|
@ -2,7 +2,7 @@
|
||||
SplFileObject::fputcsv(): error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
$fo = new SplFileObject('SplFileObject_fputcsv.csv', 'w');
|
||||
$fo = new SplFileObject(__DIR__ . '/SplFileObject_fputcsv.csv', 'w');
|
||||
|
||||
echo "*** Testing error conditions ***\n";
|
||||
// zero argument
|
||||
@ -17,6 +17,11 @@ $enclosure ="\"";
|
||||
var_dump( $fo->fputcsv($fields, $delim, $enclosure, $fo) );
|
||||
|
||||
echo "Done\n";
|
||||
--CLEAN--
|
||||
<?php
|
||||
$file = __DIR__ . '/SplFileObject_fputcsv.csv';
|
||||
unlink($file);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing error conditions ***
|
||||
-- Testing fputcsv() with zero argument --
|
||||
|
@ -8,7 +8,7 @@ Test fputcsv() : usage variations - with default enclosure & delimiter of two ch
|
||||
|
||||
echo "*** Testing fputcsv() : with default enclosure & delimiter of two chars ***\n";
|
||||
|
||||
$fo = new SplFileObject('SplFileObject_fputcsv.csv', 'w');
|
||||
$fo = new SplFileObject(__DIR__ . '/SplFileObject_fputcsv.csv', 'w');
|
||||
|
||||
var_dump($fo->fputcsv(array('water', 'fruit'), ',,', '"'));
|
||||
|
||||
@ -18,7 +18,8 @@ echo "Done\n";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink('SplFileObject::fputcsv.csv');
|
||||
$file = __DIR__ . '/SplFileObject_fputcsv.csv';
|
||||
unlink($file);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing fputcsv() : with default enclosure & delimiter of two chars ***
|
||||
|
@ -8,7 +8,7 @@ Test fputcsv() : usage variations - with enclosure & delimiter of two chars
|
||||
|
||||
echo "*** Testing fputcsv() : with enclosure & delimiter of two chars and file opened in read mode ***\n";
|
||||
|
||||
$fo = new SplFileObject('SplFileObject_fputcsv.csv', 'w');
|
||||
$fo = new SplFileObject(__DIR__ . '/SplFileObject_fputcsv.csv', 'w');
|
||||
|
||||
var_dump($fo->fputcsv(array('water', 'fruit'), ',,', '""'));
|
||||
|
||||
@ -18,7 +18,8 @@ echo "Done\n";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink('SplFileObject::fputcsv.csv');
|
||||
$file = __DIR__ . '/SplFileObject_fputcsv.csv';
|
||||
unlink($file);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing fputcsv() : with enclosure & delimiter of two chars and file opened in read mode ***
|
||||
|
Loading…
Reference in New Issue
Block a user