BrTest.php 1.7 KB

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