ConsoleTest.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /*
  3. * This file is part of the Environment package.
  4. *
  5. * (c) Sebastian Bergmann <sebastian@phpunit.de>
  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 SebastianBergmann\Environment;
  11. use PHPUnit_Framework_TestCase;
  12. class ConsoleTest extends PHPUnit_Framework_TestCase
  13. {
  14. /**
  15. * @var \SebastianBergmann\Environment\Console
  16. */
  17. private $console;
  18. protected function setUp()
  19. {
  20. $this->console = new Console;
  21. }
  22. /**
  23. * @covers \SebastianBergmann\Environment\Console::isInteractive
  24. */
  25. public function testCanDetectIfStdoutIsInteractiveByDefault()
  26. {
  27. $this->assertInternalType('boolean', $this->console->isInteractive());
  28. }
  29. /**
  30. * @covers \SebastianBergmann\Environment\Console::isInteractive
  31. */
  32. public function testCanDetectIfFileDescriptorIsInteractive()
  33. {
  34. $this->assertInternalType('boolean', $this->console->isInteractive(STDOUT));
  35. }
  36. /**
  37. * @covers \SebastianBergmann\Environment\Console::hasColorSupport
  38. *
  39. * @uses \SebastianBergmann\Environment\Console::isInteractive
  40. */
  41. public function testCanDetectColorSupport()
  42. {
  43. $this->assertInternalType('boolean', $this->console->hasColorSupport());
  44. }
  45. /**
  46. * @covers \SebastianBergmann\Environment\Console::getNumberOfColumns
  47. *
  48. * @uses \SebastianBergmann\Environment\Console::isInteractive
  49. */
  50. public function testCanDetectNumberOfColumns()
  51. {
  52. $this->assertInternalType('integer', $this->console->getNumberOfColumns());
  53. }
  54. }