BorderTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace League\CLImate\Tests;
  3. class BorderTest extends TestBase
  4. {
  5. /**
  6. * @test
  7. * @doesNotPerformAssertions
  8. */
  9. public function it_can_output_a_basic_border()
  10. {
  11. $this->shouldWrite("\e[m" . str_repeat('-', $this->util->width() ?: 100) . "\e[0m");
  12. $this->shouldHavePersisted();
  13. $this->cli->border();
  14. }
  15. /**
  16. * @test
  17. * @doesNotPerformAssertions
  18. */
  19. public function it_can_output_a_border_with_a_different_character()
  20. {
  21. $this->shouldWrite("\e[m" . str_repeat('@', $this->util->width() ?: 100) . "\e[0m");
  22. $this->shouldHavePersisted();
  23. $this->cli->border('@');
  24. }
  25. /**
  26. * @test
  27. * @doesNotPerformAssertions
  28. */
  29. public function it_can_output_a_border_with_a_different_length()
  30. {
  31. $this->shouldWrite("\e[m" . str_repeat('-', 60) . "\e[0m");
  32. $this->shouldHavePersisted();
  33. $this->cli->border('-', 60);
  34. }
  35. /**
  36. * @test
  37. * @doesNotPerformAssertions
  38. */
  39. public function it_can_output_a_border_with_an_odd_length_character_and_still_be_the_correct_length()
  40. {
  41. $this->shouldWrite("\e[m-*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*\e[0m");
  42. $this->shouldHavePersisted();
  43. $this->cli->border('-*-', 50);
  44. }
  45. }