File: colors.phpt

package info (click to toggle)
php-console-table 1.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 212 kB
  • sloc: php: 498; xml: 414; sh: 5; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 696 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--TEST--
Data with ANSI color codes
--SKIPIF--
<?php if (!(@include 'Console/Color2.php')) echo 'skip Console_Color2 not installed'; ?>
--FILE--
<?php

if (file_exists(dirname(__FILE__) . '/../Table.php')) {
    require_once dirname(__FILE__) . '/../Table.php';
} else {
    require_once 'Console/Table.php';
}
require_once 'Console/Color2.php';
$cc = new Console_Color2();

$table = new Console_Table(CONSOLE_TABLE_ALIGN_LEFT, CONSOLE_TABLE_BORDER_ASCII, 1, null, true);
$table->setHeaders(array('foo', 'bar'));
$table->addRow(array('baz', $cc->convert("%bblue%n")));

echo $table->getTable();

?>
--EXPECT--
+-----+------+
| foo | bar  |
+-----+------+
| baz | blue |
+-----+------+