BrTest.php 1.7 KB

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