1--TEST-- 2Test fputcsv() : usage variations - with enclosure & delimiter of two chars 3--FILE-- 4<?php 5 6/* Testing fputcsv() to write to a file when default enclosure value and delimiter 7 of two chars is provided and file is opened in read only mode */ 8 9echo "*** Testing fputcsv() : with enclosure & delimiter of two chars and file opened in read mode ***\n"; 10 11$fo = new SplFileObject(__DIR__ . '/SplFileObject_fputcsv_variation14.csv', 'w'); 12 13try { 14 var_dump($fo->fputcsv(array('water', 'fruit'), ',,', '""')); 15} catch (ValueError $e) { 16 echo $e->getMessage(), "\n"; 17} 18try { 19 var_dump($fo->fputcsv(array('water', 'fruit'), ',', '""')); 20} catch (ValueError $e) { 21 echo $e->getMessage(), "\n"; 22} 23 24unset($fo); 25 26echo "Done\n"; 27?> 28--CLEAN-- 29<?php 30$file = __DIR__ . '/SplFileObject_fputcsv_variation14.csv'; 31unlink($file); 32?> 33--EXPECT-- 34*** Testing fputcsv() : with enclosure & delimiter of two chars and file opened in read mode *** 35SplFileObject::fputcsv(): Argument #2 ($separator) must be a single character 36SplFileObject::fputcsv(): Argument #3 ($enclosure) must be a single character 37Done 38