BorderTest.php 1.1 KB

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