public function testLongWordsBlockWrapping() { $word = 'Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophattoperisteralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygovgollhjvhvljfezefeqifzeiqgiqzhrsdgihqzridghqridghqirshdghdghieridgheirhsdgehrsdvhqrsidhqshdgihrsidvqhneriqsdvjzergetsrfhgrstsfhsetsfhesrhdgtesfhbzrtfbrztvetbsdfbrsdfbrn'; $wordLength = strlen($word); $maxLineLength = SymfonyStyle::MAX_LINE_LENGTH - 3; $this->command->setCode(function (InputInterface $input, OutputInterface $output) use($word) { $sfStyle = new SymfonyStyleWithForcedLineLength($input, $output); $sfStyle->block($word, 'CUSTOM', 'fg=white;bg=blue', ' § ', false); }); $this->tester->execute(array(), array('interactive' => false, 'decorated' => false)); $expectedCount = (int) ceil($wordLength / $maxLineLength) + (int) ($wordLength > $maxLineLength - 5); $this->assertSame($expectedCount, substr_count($this->tester->getDisplay(true), ' § ')); }
<?php use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength; // Ensure has single blank line between blocks return function (InputInterface $input, OutputInterface $output) { $output = new SymfonyStyleWithForcedLineLength($input, $output); $output->warning('Warning'); $output->caution('Caution'); $output->error('Error'); $output->success('Success'); $output->note('Note'); $output->block('Custom block', 'CUSTOM', 'fg=white;bg=green', 'X ', true); };
<?php use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength; //Ensure long words are properly wrapped in blocks return function (InputInterface $input, OutputInterface $output) { $word = 'Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophattoperisteralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygon'; $sfStyle = new SymfonyStyleWithForcedLineLength($input, $output); $sfStyle->block($word, 'CUSTOM', 'fg=white;bg=blue', ' § ', false); };
<?php use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength; //Ensure that all lines are aligned to the begin of the first line in a very long line block return function (InputInterface $input, OutputInterface $output) { $output = new SymfonyStyleWithForcedLineLength($input, $output); $output->block('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum', 'CUSTOM', 'fg=white;bg=green', 'X ', true); };
<?php use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength; //Ensure that all lines are aligned to the begin of the first line in a multi-line block return function (InputInterface $input, OutputInterface $output) { $output = new SymfonyStyleWithForcedLineLength($input, $output); $output->block(array('Custom block', 'Second custom block line'), 'CUSTOM', 'fg=white;bg=green', 'X ', true); };