TabTest.php 1.7 KB

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