3 namespace Symfony\Component\Console\Tests\Style;
5 use PHPUnit_Framework_TestCase;
21 $this->command =
new Command(
'sfstyle');
27 $this->command = null;
34 public function testOutputs($inputCommandFilepath, $outputFilepath)
36 $code = require $inputCommandFilepath;
37 $this->command->setCode($code);
38 $this->tester->execute(array(), array(
'interactive' =>
false,
'decorated' =>
false));
39 $this->assertStringEqualsFile($outputFilepath, $this->tester->getDisplay(
true));
44 $baseDir = __DIR__.
'/../Fixtures/Style/SymfonyStyle';
46 return array_map(null, glob(
$baseDir.
'/command/command_*.php'), glob(
$baseDir.
'/output/output_*.txt'));
51 $word =
'Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophattoperisteralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygon';
52 $wordLength = strlen($word);
57 $sfStyle->block($word,
'CUSTOM',
'fg=white;bg=blue',
' § ',
false);
60 $this->tester->execute(array(), array(
'interactive' =>
false,
'decorated' =>
false));
61 $expectedCount = (int) ceil($wordLength / ($maxLineLength)) + (
int) ($wordLength > $maxLineLength - 5);
62 $this->assertSame($expectedCount, substr_count($this->tester->getDisplay(
true),
' § '));