From ac75d32c9fd53456ba11fd9b825a018a49428e68 Mon Sep 17 00:00:00 2001 From: Ronan Giron Date: Tue, 8 Jun 2021 00:07:05 +0200 Subject: [PATCH] Fix test for Linux system --- .../CLImate/TerminalObject/CardTest.php | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/tests/Console/CLImate/TerminalObject/CardTest.php b/tests/Console/CLImate/TerminalObject/CardTest.php index a7676e1..51d650a 100644 --- a/tests/Console/CLImate/TerminalObject/CardTest.php +++ b/tests/Console/CLImate/TerminalObject/CardTest.php @@ -29,18 +29,15 @@ public function testResult() ); $card->util(new UtilFactory()); - $this->assertEquals( - [ - ' ', - ' Horum adventum praedocti speculationibus fidis rectores militum tessera data sollemni armatos omnes celeri eduxere ', - ' procursu et agiliter praeterito Calycadni fluminis ponte, cuius undarum magnitudo murorum adluit turres, in speciem ', - ' locavere pugnandi. neque tamen exiluit quisquam nec permissus est congredi. formidabatur enim flagrans vesania man ', - ' us et superior numero et ruitura sine respectu salutis in ferrum. ', - ' Homines enim eruditos et sobrios ut infaustos et inutiles vitant, eo quoque accedente quod et nomenclatores adsueti ', - ' haec et talia venditare, mercede accepta lucris quosdam et prandiis inserunt subditicios ignobiles et obscuros. ', - ' ', - ], - $card->result() - ); + $result = $card->result(); + + $this->assertMatchesRegularExpression('/^\s+$/', $firstLine = array_shift($result)); + $this->assertMatchesRegularExpression('/^\s+$/', $lastLine = array_pop($result)); + $this->assertEquals(strlen($firstLine), strlen($lastLine)); + + foreach ($result as $line) { + $this->assertTrue(str_starts_with($line, ' ')); + $this->assertTrue(str_ends_with($line, ' ')); + } } }