Example #1
0
/*
 * This file is part of the Lime framework.
 *
 * (c) Fabien Potencier <*****@*****.**>
 * (c) Bernhard Schussek <*****@*****.**>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */
$t = new LimeTest();
$t->diag('Text can be colorized with font and color styles');
$c = new LimeColorizer();
$t->is($c->colorize('Hello World', array('bold' => true)), "Hello World", 'Text can be bold');
$t->is($c->colorize('Hello World', array('underscore' => true)), "Hello World", 'Text can be underscored');
$t->is($c->colorize('Hello World', array('blink' => true)), "Hello World", 'Text can be blinking');
$t->is($c->colorize('Hello World', array('reverse' => true)), "Hello World", 'Text can be reversed');
$t->is($c->colorize('Hello World', array('conceal' => true)), "Hello World", 'Text can be invisible');
$t->is($c->colorize('Hello World', array('fg' => 'white')), "Hello World", 'Text can have a custom text color');
$t->is($c->colorize('Hello World', array('bg' => 'white')), "Hello World", 'Text can have a custom background color');
$t->is($c->colorize('Hello World', array('bold' => true, 'fg' => 'black', 'bg' => 'white')), "Hello World", 'Styles can be combined');
$t->diag('Text styles can be preset using ->setStyle()');
$c = new LimeColorizer();
$c->setStyle('test_style', array('bold' => true, 'fg' => 'black', 'bg' => 'white'));
$t->is($c->colorize('Hello World', 'test_style'), "Hello World", 'Predefined styles can be used');
$t->diag('Text styles can be preset using backwards compatible ::style()');
LimeAutoloader::enableLegacyMode();
lime_colorizer::style('test_style', array('bold' => true, 'fg' => 'black', 'bg' => 'white'));
$c = new lime_colorizer();
$t->is($c->colorize('Hello World', 'test_style'), "Hello World", 'Predefined styles can be used');