DrawTest.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace League\CLImate\Tests;
  3. class DrawTest extends TestBase
  4. {
  5. protected function drawWorks()
  6. {
  7. $this->shouldWrite("\e[m __ ______ _____ _ __ _____\e[0m");
  8. $this->shouldWrite("\e[m \ \ / / __ \| __ \| |/ // ____|\e[0m");
  9. $this->shouldWrite("\e[m \ \ /\ / / | | | |__) | ' /| (___\e[0m");
  10. $this->shouldWrite("\e[m \ \/ \/ /| | | | _ /| < \___ \\\e[0m");
  11. $this->shouldWrite("\e[m \ /\ / | |__| | | \ \| . \ ____) |\e[0m");
  12. $this->shouldWrite("\e[m \/ \/ \____/|_| \_\_|\_\_____/\e[0m");
  13. $this->shouldHavePersisted();
  14. }
  15. /** @test */
  16. public function it_can_draw_something()
  17. {
  18. $this->shouldWrite("\e[m ( )\e[0m");
  19. $this->shouldWrite("\e[m H\e[0m");
  20. $this->shouldWrite("\e[m H\e[0m");
  21. $this->shouldWrite("\e[m _H_\e[0m");
  22. $this->shouldWrite("\e[m .-'-.-'-.\e[0m");
  23. $this->shouldWrite("\e[m / \\\e[0m");
  24. $this->shouldWrite("\e[m| |\e[0m");
  25. $this->shouldWrite("\e[m| .-------'._\e[0m");
  26. $this->shouldWrite("\e[m| / / '.' '. \\\e[0m");
  27. $this->shouldWrite("\e[m| \ \ @ @ / /\e[0m");
  28. $this->shouldWrite("\e[m| '---------'\e[0m");
  29. $this->shouldWrite("\e[m| _______|\e[0m");
  30. $this->shouldWrite("\e[m| .'-+-+-+|\e[0m");
  31. $this->shouldWrite("\e[m| '.-+-+-+|\e[0m");
  32. $this->shouldWrite("\e[m| \"\"\"\"\"\" |\e[0m");
  33. $this->shouldWrite("\e[m'-.__ __.-'\e[0m");
  34. $this->shouldWrite("\e[m \"\"\"\e[0m");
  35. $this->shouldHavePersisted();
  36. $this->cli->draw('bender');
  37. }
  38. /** @test */
  39. public function it_404s_when_it_gets_invalid_art()
  40. {
  41. $this->shouldWrite("\e[m _ _ ___ _ _\e[0m");
  42. $this->shouldWrite("\e[m | || | / _ \| || |\e[0m");
  43. $this->shouldWrite("\e[m | || |_| | | | || |_\e[0m");
  44. $this->shouldWrite("\e[m |__ _| | | |__ _|\e[0m");
  45. $this->shouldWrite("\e[m | | | |_| | | |\e[0m");
  46. $this->shouldWrite("\e[m |_| \___/ |_|\e[0m");
  47. $this->shouldHavePersisted();
  48. $this->cli->draw('something-that-doesnt-exist');
  49. }
  50. /** @test */
  51. public function it_can_take_a_custom_art_directory()
  52. {
  53. $this->drawWorks();
  54. $this->cli->addArt(__DIR__ . '/art');
  55. $this->cli->draw('works');
  56. }
  57. /** @test */
  58. public function it_can_take_a_custom_art_directory_with_a_trailing_slash()
  59. {
  60. $this->drawWorks();
  61. $this->cli->addArt(__DIR__ . '/art/');
  62. $this->cli->draw('works');
  63. }
  64. /** @test */
  65. public function it_can_chain_the_art_setting()
  66. {
  67. $this->drawWorks();
  68. $this->cli->addArt(__DIR__ . '/art')->draw('works');
  69. }
  70. }