TabTest.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace League\CLImate\Tests;
  3. class TabTest extends TestBase
  4. {
  5. /** @test */
  6. public function it_can_output_a_tab()
  7. {
  8. $this->output->shouldReceive("sameLine");
  9. $this->shouldWrite("\e[m\t\e[0m");
  10. $this->shouldHavePersisted();
  11. $this->cli->tab();
  12. }
  13. /** @test */
  14. public function it_is_chainable()
  15. {
  16. $this->output->shouldReceive("sameLine");
  17. $this->shouldWrite("\e[m\t\e[0m");
  18. $this->shouldWrite("\e[mThis is indented.\e[0m");
  19. $this->shouldHavePersisted(2);
  20. $this->cli->tab()->out('This is indented.');
  21. }
  22. /** @test */
  23. public function it_can_accept_the_number_of_tabs_as_an_argument()
  24. {
  25. $this->output->shouldReceive("sameLine");
  26. $this->shouldWrite("\e[m\t\t\t\e[0m");
  27. $this->shouldWrite("\e[mThis is really indented.\e[0m");
  28. $this->shouldHavePersisted(2);
  29. $this->cli->tab(3)->out('This is really indented.');
  30. }
  31. /** @test */
  32. public function it_will_ignore_a_negative_number_of_tabs()
  33. {
  34. $this->output->shouldReceive("sameLine");
  35. $this->shouldWrite("\e[m\t\e[0m");
  36. $this->shouldHavePersisted();
  37. $this->cli->tab(-3);
  38. }
  39. /** @test */
  40. public function it_will_ignore_a_partial_number_of_tabs()
  41. {
  42. $this->output->shouldReceive("sameLine");
  43. $this->shouldWrite("\e[m\t\t\e[0m");
  44. $this->shouldHavePersisted();
  45. $this->cli->tab(2.7);
  46. }
  47. }