ClearLineTest.php 647 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace League\CLImate\Tests\TerminalObject\Basic;
  3. use League\CLImate\Tests\TestBase;
  4. class ClearLineTest extends TestBase
  5. {
  6. public function testClearOneLine()
  7. {
  8. $this->output->shouldReceive("sameLine")->andReturn(true);
  9. $this->shouldWrite("\e[m\r\e[K\e[1A\e[1B\e[0m");
  10. $this->shouldHavePersisted();
  11. $this->cli->clearLine();
  12. }
  13. public function testClearTwoLines()
  14. {
  15. $this->output->shouldReceive("sameLine")->andReturn(true);
  16. $this->shouldWrite("\e[m\r\e[K\e[1A\r\e[K\e[1A\e[1B\e[0m");
  17. $this->shouldHavePersisted();
  18. $this->cli->clearLine(2);
  19. }
  20. }