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 003: Windows EOL
3
--FILE--
4
<?php
5
// $Id: 003.phpt,v 1.3 2007/05/11 21:49:01 cipri Exp $
6
/**
7
 * Test for:
8
 * - File_CSV::discoverFormat()
9
 * - File_CSV::read()
10
 */
11
 
12
require_once 'File/CSV.php';
13
 
14
$file = dirname(__FILE__) . '/003.csv';
15
$conf = File_CSV::discoverFormat($file);
16
 
17
print "Format:\n";
18
print_r($conf);
19
print "\n";
20
 
21
$data = array();
22
while ($res = File_CSV::read($file, $conf)) {
23
    $data[] = $res;
24
}
25
 
26
print "Data:\n";
27
print_r($data);
28
?>
29
--EXPECT--
30
Format:
31
Array
32
(
33
    [fields] => 4
34
    [sep] => ,
35
    [quote] => "
36
)
37
 
38
Data:
39
Array
40
(
41
    [0] => Array
42
        (
43
            [0] => Field 1-1
44
            [1] => Field 1-2
45
            [2] => Field 1-3
46
            [3] => Field 1-4
47
        )
48
 
49
    [1] => Array
50
        (
51
            [0] => Field 2-1
52
            [1] => Field 2-2
53
            [2] => Field 2-3
54
            [3] => I'm multiline
55
Field
56
        )
57
 
58
    [2] => Array
59
        (
60
            [0] => Field 3-1
61
            [1] => Field 3-2
62
            [2] => Field 3-3
63
            [3] =>
64
        )
65
 
66
)