Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
--TEST--
2
Multiline table cells
3
--FILE--
4
<?php
5
 
6
if (file_exists(dirname(__FILE__) . '/../Table.php')) {
7
    require_once dirname(__FILE__) . '/../Table.php';
8
} else {
9
    require_once 'Console/Table.php';
10
}
11
 
12
$data = array(
13
    array('col1', '0', "col3\nmultiline", 'col4'),
14
    array('r2col1', 'r2col2', "r2col3\nmultiline", 'r2col4'),
15
    array('r3col1', 'r3col2', "r3col3\nmultiline\r\nverymuch", 'r3col4'),
16
    array('r4col1', 'r4col2', "r4col3", 'r4col4'),
17
    array('r5col1', 'r5col2', "r5col3", 'r5col4'),
18
);
19
 
20
$table = new Console_Table();
21
$table->setHeaders(array("h1\nmultiline", 'h2', "h3", 'h4'));
22
$table->addData($data);
23
echo $table->getTable();
24
 
25
echo Console_Table::fromArray(array('one line header'),
26
                              array(array("multiple\nlines"),
27
                                    array('one line')));
28
 
29
?>
30
--EXPECT--
31
+-----------+--------+-----------+--------+
32
| h1        | h2     | h3        | h4     |
33
| multiline |        |           |        |
34
+-----------+--------+-----------+--------+
35
| col1      | 0      | col3      | col4   |
36
|           |        | multiline |        |
37
| r2col1    | r2col2 | r2col3    | r2col4 |
38
|           |        | multiline |        |
39
| r3col1    | r3col2 | r3col3    | r3col4 |
40
|           |        | multiline |        |
41
|           |        | verymuch  |        |
42
| r4col1    | r4col2 | r4col3    | r4col4 |
43
| r5col1    | r5col2 | r5col3    | r5col4 |
44
+-----------+--------+-----------+--------+
45
+-----------------+
46
| one line header |
47
+-----------------+
48
| multiple        |
49
| lines           |
50
| one line        |
51
+-----------------+