Made some SplFileObject::fputcsv not pollute the working dir.

This commit is contained in:
Gustavo André dos Santos Lopes 2012-03-21 13:13:17 +00:00
parent 09e367dbaf
commit 54f0d50d3e
4 changed files with 15 additions and 7 deletions

View File

@ -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

View File

@ -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 --

View File

@ -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 ***

View File

@ -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 ***