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 002: Fields count more than expected
3
--FILE--
4
<?php
5
// $Id: 002.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__) . '/002.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] => Field 2-4
55
        )
56
 
57
    [2] => Array
58
        (
59
            [0] => Field 3-1
60
            [1] => Field 3-2
61
            [2] =>
62
            [3] =>
63
        )
64
 
65
    [3] => Array
66
        (
67
            [0] => Field 4-1
68
            [1] =>
69
            [2] =>
70
            [3] =>
71
        )
72
 
73
)