BrTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace League\CLImate\Tests;
  3. class BrTest extends TestBase
  4. {
  5. /** @test */
  6. public function it_can_output_a_line_break()
  7. {
  8. $this->shouldWrite("\e[m\e[0m");
  9. $this->shouldHavePersisted();
  10. $this->cli->br();
  11. }
  12. /** @test */
  13. public function it_is_chainable()
  14. {
  15. $this->shouldWrite("\e[m\e[0m");
  16. $this->shouldWrite("\e[mThis is a line further down.\e[0m");
  17. $this->shouldHavePersisted(2);
  18. $this->cli->br()->out('This is a line further down.');
  19. }
  20. /** @test */
  21. public function it_can_accept_the_number_of_breaks_as_an_argument()
  22. {
  23. $this->shouldWrite("\e[m\e[0m", 3);
  24. $this->shouldWrite("\e[mThis is a line further down.\e[0m");
  25. $this->shouldHavePersisted(2);
  26. $this->cli->br(3)->out('This is a line further down.');
  27. }
  28. /** @test */
  29. public function it_will_ignore_a_negative_number_of_breaks()
  30. {
  31. $this->shouldWrite("\e[m\e[0m");
  32. $this->shouldWrite("\e[mThis is a line further down.\e[0m");
  33. $this->shouldHavePersisted(2);
  34. $this->cli->br(-3)->out('This is a line further down.');
  35. }
  36. /** @test */
  37. public function it_will_ignore_a_partial_number_of_breaks()
  38. {
  39. $this->shouldWrite("\e[m\e[0m", 4);
  40. $this->shouldWrite("\e[mThis is a line further down.\e[0m");
  41. $this->shouldHavePersisted(2);
  42. $this->cli->br(4.2)->out('This is a line further down.');
  43. }
  44. }