4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Console\Tests\Helper;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Console\Helper\FormatterHelper;
17 class FormatterHelperTest extends TestCase
19 public function testFormatSection()
21 $formatter = new FormatterHelper();
24 '<info>[cli]</info> Some text to display',
25 $formatter->formatSection('cli', 'Some text to display'),
26 '::formatSection() formats a message in a section'
30 public function testFormatBlock()
32 $formatter = new FormatterHelper();
35 '<error> Some text to display </error>',
36 $formatter->formatBlock('Some text to display', 'error'),
37 '::formatBlock() formats a message in a block'
41 '<error> Some text to display </error>'."\n".
42 '<error> foo bar </error>',
43 $formatter->formatBlock(array('Some text to display', 'foo bar'), 'error'),
44 '::formatBlock() formats a message in a block'
48 '<error> </error>'."\n".
49 '<error> Some text to display </error>'."\n".
51 $formatter->formatBlock('Some text to display', 'error', true),
52 '::formatBlock() formats a message in a block'
56 public function testFormatBlockWithDiacriticLetters()
58 $formatter = new FormatterHelper();
61 '<error> </error>'."\n".
62 '<error> Du texte à afficher </error>'."\n".
64 $formatter->formatBlock('Du texte à afficher', 'error', true),
65 '::formatBlock() formats a message in a block'
69 public function testFormatBlockWithDoubleWidthDiacriticLetters()
71 $formatter = new FormatterHelper();
73 '<error> </error>'."\n".
74 '<error> 表示するテキスト </error>'."\n".
76 $formatter->formatBlock('表示するテキスト', 'error', true),
77 '::formatBlock() formats a message in a block'
81 public function testFormatBlockLGEscaping()
83 $formatter = new FormatterHelper();
86 '<error> </error>'."\n".
87 '<error> \<info>some info\</info> </error>'."\n".
89 $formatter->formatBlock('<info>some info</info>', 'error', true),
90 '::formatBlock() escapes \'<\' chars'