Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
--TEST--
2
File_CSV Test Case bug5553: Write a file with delimiter inside quotes and don't pass the quote option
3
--FILE--
4
<?php
5
// $Id: bug5553.phpt,v 1.4 2007/05/11 21:49:01 cipri Exp $
6
/**
7
 * Write a file with delimiter inside quotes and don't pass the quote option
8
 */
9
require_once 'File/CSV.php';
10
 
11
$conf = array();
12
$data = array();
13
 
14
$conf['fields'] = 3;
15
$conf['sep']    = ',';
16
$conf['quote']  = '"';
17
 
18
$data[] = 'Hi';
19
$data[] = 'Hello';
20
$data[] = 'Hi,world';
21
 
22
$file = dirname(__FILE__) . '/bug5553.csv';
23
$res = File_CSV::write($file, $data, $conf);
24
 
25
echo "Write:\n";
26
var_dump($res);
27
echo "\n";
28
 
29
$read = array();
30
while ($res = File_CSV::read($file, $conf)) {
31
    $read[] = $res;
32
}
33
 
34
echo "Data:\n";
35
print_r($read);
36
echo "\n";
37
 
38
@unlink(dirname(__FILE__) . '/bug5553.csv');
39
?>
40
--EXPECT--
41
Write:
42
bool(true)
43
 
44
Data:
45
Array
46
(
47
    [0] => Array
48
        (
49
            [0] => Hi
50
            [1] => Hello
51
            [2] => Hi,world
52
        )
53
 
54
)