Skip to content

Commit f5c68b3

Browse files
committed
Merge branch '5.4' into 6.3
* 5.4: [Console] Mention `Terminal`
2 parents 0db083a + ca1885a commit f5c68b3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

console.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,21 @@ call ``setAutoExit(false)`` on it to get the command result in ``CommandTester``
574574
:class:`Symfony\\Component\\Console\\Application`
575575
and extend the normal ``\PHPUnit\Framework\TestCase``.
576576

577+
When testing your commands, it could be useful to understand how your command
578+
reacts on different settings like the width and the height of the terminal.
579+
You have access to such information thanks to the
580+
:class:`Symfony\\Component\\Console\\Terminal` class:
581+
582+
use Symfony\Component\Console\Terminal;
583+
584+
$terminal = new Terminal();
585+
586+
// gets the number of lines available
587+
$height = $terminal->getHeight();
588+
589+
// gets the number of columns available
590+
$width = $terminal->getWidth();
591+
577592
Logging Command Errors
578593
----------------------
579594

0 commit comments

Comments
 (0)