TabTest.php 1.7 KB

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