SplFileObject_fputcsv_variation13.phpt 745 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. Test fputcsv() : usage variations - with default enclosure & delimiter of two chars
  3. --FILE--
  4. <?php
  5. /* Testing fputcsv() to write to a file when default enclosure value and delimiter
  6. of two chars is provided */
  7. echo "*** Testing fputcsv() : with default enclosure & delimiter of two chars ***\n";
  8. $fo = new SplFileObject(__DIR__ . '/SplFileObject_fputcsv.csv', 'w');
  9. var_dump($fo->fputcsv(array('water', 'fruit'), ',,', '"'));
  10. unset($fo);
  11. echo "Done\n";
  12. ?>
  13. --CLEAN--
  14. <?php
  15. $file = __DIR__ . '/SplFileObject_fputcsv.csv';
  16. unlink($file);
  17. ?>
  18. --EXPECTF--
  19. *** Testing fputcsv() : with default enclosure & delimiter of two chars ***
  20. Warning: SplFileObject::fputcsv(): delimiter must be a character in %s on line %d
  21. bool(false)
  22. Done