From dbdf2a06507efda264114e247f7e62d4cde77564 Mon Sep 17 00:00:00 2001 From: Craig Duncan Date: Sat, 10 Feb 2018 20:42:05 +0000 Subject: [PATCH] Organise the tests into folders matching the classes they test --- tests/{ => Argument}/ArgumentTest.php | 4 +- .../{ => Decorator/Component}/CommandTest.php | 3 +- tests/{ => Decorator/Parser}/AnsiTest.php | 3 +- tests/{ => Decorator}/StyleTest.php | 4 +- .../{ => TerminalObject/Basic}/BorderTest.php | 4 +- tests/{ => TerminalObject/Basic}/BrTest.php | 4 +- .../{ => TerminalObject/Basic}/ClearTest.php | 4 +- .../Basic/ColumnsTest.php} | 6 ++- tests/{ => TerminalObject/Basic}/DrawTest.php | 12 +++--- tests/{ => TerminalObject/Basic}/DumpTest.php | 4 +- .../{ => TerminalObject/Basic}/FlankTest.php | 4 +- .../{ => TerminalObject/Basic}/InlineTest.php | 4 +- tests/TerminalObject/Basic/JsonTest.php | 40 +++++++++---------- tests/{ => TerminalObject/Basic}/TabTest.php | 4 +- .../{ => TerminalObject/Basic}/TableTest.php | 3 +- .../Basic}/VarDumpMock.php | 0 .../Dynamic}/Animation/AnimationTest.php | 16 ++++---- .../Dynamic}/Animation/ExitToBottomFrames.php | 2 +- .../Dynamic}/Animation/ExitToLeftFrames.php | 2 +- .../Dynamic}/Animation/ExitToRightFrames.php | 2 +- .../Dynamic}/Animation/ExitToTopFrames.php | 2 +- .../Dynamic}/Animation/RunFrames.php | 2 +- .../Dynamic}/CheckboxesTest.php | 3 +- .../Dynamic}/ConfirmTest.php | 4 +- .../Dynamic}/InputTest.php | 4 +- .../Dynamic}/PaddingTest.php | 4 +- .../Dynamic}/PasswordTest.php | 4 +- .../Dynamic}/ProgressTest.php | 3 +- .../Dynamic}/RadioTest.php | 4 +- .../Helper}/SleeperGlobalMock.php | 0 .../Helper}/SleeperTest.php | 3 +- .../Router}/RouterTest.php | 3 +- tests/TestBase.php | 2 +- tests/{ => Util}/HelperTest.php | 3 +- tests/{ => Util}/OutputTest.php | 3 +- tests/{ => Util/Reader}/StdinGlobalMock.php | 0 tests/{ => Util/Reader}/StdinTest.php | 3 +- tests/{ => Util/System}/LinuxTest.php | 3 +- tests/{ => Util/System}/WindowsTest.php | 3 +- tests/{ => Util/Writer}/BufferTest.php | 3 +- tests/{ => Util/Writer}/FileGlobalMock.php | 0 tests/{ => Util/Writer}/FileTest.php | 5 ++- 42 files changed, 114 insertions(+), 72 deletions(-) rename tests/{ => Argument}/ArgumentTest.php (99%) rename tests/{ => Decorator/Component}/CommandTest.php (93%) rename tests/{ => Decorator/Parser}/AnsiTest.php (97%) rename tests/{ => Decorator}/StyleTest.php (99%) rename tests/{ => TerminalObject/Basic}/BorderTest.php (93%) rename tests/{ => TerminalObject/Basic}/BrTest.php (94%) rename tests/{ => TerminalObject/Basic}/ClearTest.php (79%) rename tests/{ColumnTest.php => TerminalObject/Basic/ColumnsTest.php} (97%) rename tests/{ => TerminalObject/Basic}/DrawTest.php (86%) rename tests/{ => TerminalObject/Basic}/DumpTest.php (78%) rename tests/{ => TerminalObject/Basic}/FlankTest.php (93%) rename tests/{ => TerminalObject/Basic}/InlineTest.php (86%) rename tests/{ => TerminalObject/Basic}/TabTest.php (94%) rename tests/{ => TerminalObject/Basic}/TableTest.php (99%) rename tests/{ => TerminalObject/Basic}/VarDumpMock.php (100%) rename tests/{ => TerminalObject/Dynamic}/Animation/AnimationTest.php (95%) rename tests/{ => TerminalObject/Dynamic}/Animation/ExitToBottomFrames.php (98%) rename tests/{ => TerminalObject/Dynamic}/Animation/ExitToLeftFrames.php (98%) rename tests/{ => TerminalObject/Dynamic}/Animation/ExitToRightFrames.php (99%) rename tests/{ => TerminalObject/Dynamic}/Animation/ExitToTopFrames.php (97%) rename tests/{ => TerminalObject/Dynamic}/Animation/RunFrames.php (97%) rename tests/{ => TerminalObject/Dynamic}/CheckboxesTest.php (98%) rename tests/{ => TerminalObject/Dynamic}/ConfirmTest.php (94%) rename tests/{ => TerminalObject/Dynamic}/InputTest.php (98%) rename tests/{ => TerminalObject/Dynamic}/PaddingTest.php (96%) rename tests/{ => TerminalObject/Dynamic}/PasswordTest.php (83%) rename tests/{ => TerminalObject/Dynamic}/ProgressTest.php (99%) rename tests/{ => TerminalObject/Dynamic}/RadioTest.php (95%) rename tests/{ => TerminalObject/Helper}/SleeperGlobalMock.php (100%) rename tests/{ => TerminalObject/Helper}/SleeperTest.php (93%) rename tests/{ => TerminalObject/Router}/RouterTest.php (87%) rename tests/{ => Util}/HelperTest.php (93%) rename tests/{ => Util}/OutputTest.php (99%) rename tests/{ => Util/Reader}/StdinGlobalMock.php (100%) rename tests/{ => Util/Reader}/StdinTest.php (96%) rename tests/{ => Util/System}/LinuxTest.php (95%) rename tests/{ => Util/System}/WindowsTest.php (95%) rename tests/{ => Util/Writer}/BufferTest.php (95%) rename tests/{ => Util/Writer}/FileGlobalMock.php (100%) rename tests/{ => Util/Writer}/FileTest.php (96%) diff --git a/tests/ArgumentTest.php b/tests/Argument/ArgumentTest.php similarity index 99% rename from tests/ArgumentTest.php rename to tests/Argument/ArgumentTest.php index 59a25fea..89d9d22c 100644 --- a/tests/ArgumentTest.php +++ b/tests/Argument/ArgumentTest.php @@ -1,10 +1,11 @@ drawWorks(); - $this->cli->addArt(__DIR__ . \DIRECTORY_SEPARATOR . 'art'); + $this->cli->addArt(__DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'art'); $this->cli->draw('works'); } @@ -84,7 +86,7 @@ public function it_can_take_a_custom_art_directory() public function it_can_take_a_custom_art_directory_with_a_trailing_slash() { $this->drawWorks(); - $this->cli->addArt(__DIR__ . \DIRECTORY_SEPARATOR . 'art' . \DIRECTORY_SEPARATOR); + $this->cli->addArt(__DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'art' . \DIRECTORY_SEPARATOR); $this->cli->draw('works'); } @@ -95,7 +97,7 @@ public function it_can_take_a_custom_art_directory_with_a_trailing_slash() public function it_can_chain_the_art_setting() { $this->drawWorks(); - $this->cli->addArt(__DIR__ . \DIRECTORY_SEPARATOR . 'art')->draw('works'); + $this->cli->addArt(__DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'art')->draw('works'); } @@ -110,7 +112,7 @@ public function testAddArt1() $this->shouldWrite("\e[m\e[0m"); $this->shouldHavePersisted(); - $this->cli->addArt(__DIR__ . "/art/"); + $this->cli->addArt(__DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . "art/"); $this->cli->draw("art"); } diff --git a/tests/DumpTest.php b/tests/TerminalObject/Basic/DumpTest.php similarity index 78% rename from tests/DumpTest.php rename to tests/TerminalObject/Basic/DumpTest.php index ed9a7865..d386c2a3 100644 --- a/tests/DumpTest.php +++ b/tests/TerminalObject/Basic/DumpTest.php @@ -1,6 +1,8 @@ "Cell 1", - "cell2" => "Cell 2", - "cell3" => "Cell 3", - "cell4" => "Cell 4", - ], \JSON_PRETTY_PRINT); + $should_be = json_encode((object) [ + 'cell1' => 'Cell 1', + 'cell2' => 'Cell 2', + 'cell3' => 'Cell 3', + 'cell4' => 'Cell 4', + ], JSON_PRETTY_PRINT); - $this->shouldWrite("\e[m{$json}\e[0m"); + $this->shouldWrite("\e[m" . $should_be . "\e[0m"); $this->shouldHavePersisted(); $this->cli->json((object) [ - "cell1" => "Cell 1", - "cell2" => "Cell 2", - "cell3" => "Cell 3", - "cell4" => "Cell 4", - ]); + 'cell1' => 'Cell 1', + 'cell2' => 'Cell 2', + 'cell3' => 'Cell 3', + 'cell4' => 'Cell 4', + ]); } /** * We do this test specifically because json escapes the tags, - * we want to make sure we"re taking care of that + * we want to make sure we're taking care of that * * @test * @doesNotPerformAssertions */ public function it_can_output_json_with_tags() { - $json = json_encode((object) [ - "cell1" => "Cell 1", - "cell2" => "Cell 2", - "cell3" => "Cell 3", - "cell4" => "Cell 4", + $should_be = json_encode((object) [ + "cell1" => 'Cell 1', + "cell2" => 'Cell 2', + "cell3" => 'Cell 3', + "cell4" => 'Cell 4', ], \JSON_PRETTY_PRINT); - $json = str_replace("Cell 4", "\e[5mCell 4\e[0m", $json); + $should_be = str_replace('Cell 4', "\e[5mCell 4\e[0m", $should_be); - $this->shouldWrite("\e[m{$json}\e[0m"); + $this->shouldWrite("\e[m" . $should_be . "\e[0m"); $this->shouldHavePersisted(); $this->cli->json((object) [ diff --git a/tests/TabTest.php b/tests/TerminalObject/Basic/TabTest.php similarity index 94% rename from tests/TabTest.php rename to tests/TerminalObject/Basic/TabTest.php index f72f68d5..0d229575 100644 --- a/tests/TabTest.php +++ b/tests/TerminalObject/Basic/TabTest.php @@ -1,6 +1,8 @@ cli->addArt(__DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'art'); + $this->cli->addArt(__DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'art'); } - protected function emptyFrame() { $this->shouldWrite("\e[m\e[0m")->ordered(); diff --git a/tests/Animation/ExitToBottomFrames.php b/tests/TerminalObject/Dynamic/Animation/ExitToBottomFrames.php similarity index 98% rename from tests/Animation/ExitToBottomFrames.php rename to tests/TerminalObject/Dynamic/Animation/ExitToBottomFrames.php index 88f3bd7c..a5dbe6b2 100644 --- a/tests/Animation/ExitToBottomFrames.php +++ b/tests/TerminalObject/Dynamic/Animation/ExitToBottomFrames.php @@ -1,6 +1,6 @@