ClearLineTest.php 743 B

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