8000 [Console] [SymfonyStyle] Replace long word wrapping test to directly … · symfony/symfony@b78fff4 · GitHub
[go: up one dir, main page]

Skip to content

Commit b78fff4

Browse files
committed
[Console] [SymfonyStyle] Replace long word wrapping test to directly test output
1 parent a842b97 commit b78fff4

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
use Symfony\Component\Console\Input\InputInterface;
4+
use Symfony\Component\Console\Output\OutputInterface;
5+
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
6+
7+
//Ensure long words are properly wrapped in blocks
8+
return function (InputInterface $input, OutputInterface $output) {
9+
$word = 'Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophattoperisteralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygon';
10+
$sfStyle = new SymfonyStyleWithForcedLineLength($input, $output);
11+
$sfStyle->block($word, 'CUSTOM', 'fg=white;bg=blue', ' § ', false);
12+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
§ [CUSTOM] Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophatto
3+
§ peristeralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygon
4+

src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,6 @@ public function inputCommandToOutputFilesProvider()
5454

5555
return array_map(null, glob($baseDir.'/command/command_*.php'), glob($baseDir.'/output/output_*.txt'));
5656
}
57-
58-
public function testLongWordsBlockWrapping()
59-
{
60-
$word = 'Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophattoperisteralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygovgollhjvhvljfezefeqifzeiqgiqzhrsdgihqzridghqridghqirshdghdghieridgheirhsdgehrsdvhqrsidhqshdgihrsidvqhneriqsdvjzergetsrfhgrstsfhsetsfhesrhdgtesfhbzrtfbrztvetbsdfbrsdfbrn';
61-
$wordLength = strlen($word);
62-
$maxLineLength = SymfonyStyle::MAX_LINE_LENGTH - 3;
63-
64-
$this->command->setCode(function (InputInterface $input, OutputInterface $output) use ($word) {
65-
$sfStyle = new SymfonyStyleWithForcedLineLength($input, $output);
66-
$sfStyle->block($word, 'CUSTOM', 'fg=white;bg=blue', ' § ', false);
67-
});
68-
69-
$this->tester->execute(array(), array('interactive' => false, 'decorated' => false));
70-
$expectedCount = (int) ceil($wordLength / ($maxLineLength)) + (int) ($wordLength > $maxLineLength - 5);
71-
$this->assertSame($expectedCount, substr_count($this->tester->getDisplay(true), ' § '));
72-
}
7357
}
7458

7559
/**

0 commit comments

Comments
 (0)
0