TerminalTest.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Console\Tests;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\Console\Terminal;
  13. class TerminalTest extends TestCase
  14. {
  15. public function test()
  16. {
  17. putenv('COLUMNS=100');
  18. putenv('LINES=50');
  19. $terminal = new Terminal();
  20. $this->assertSame(100, $terminal->getWidth());
  21. $this->assertSame(50, $terminal->getHeight());
  22. putenv('COLUMNS=120');
  23. putenv('LINES=60');
  24. $terminal = new Terminal();
  25. $this->assertSame(120, $terminal->getWidth());
  26. $this->assertSame(60, $terminal->getHeight());
  27. }
  28. public function test_zero_values()
  29. {
  30. putenv('COLUMNS=0');
  31. putenv('LINES=0');
  32. $terminal = new Terminal();
  33. $this->assertSame(0, $terminal->getWidth());
  34. $this->assertSame(0, $terminal->getHeight());
  35. }
  36. }