-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: extract command output normalization to CommandOutputHelper class
- Loading branch information
Showing
7 changed files
with
69 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Orisai\Scheduler\Helpers; | ||
|
||
use Symfony\Component\Console\Tester\CommandTester; | ||
use function array_map; | ||
use function explode; | ||
use function implode; | ||
use function preg_replace; | ||
use function rtrim; | ||
use const PHP_EOL; | ||
|
||
final class CommandOutputHelper | ||
{ | ||
|
||
public static function getCommandOutput(CommandTester $tester): string | ||
{ | ||
return implode( | ||
PHP_EOL, | ||
array_map( | ||
static fn (string $s): string => rtrim($s), | ||
explode(PHP_EOL, preg_replace('~\R~u', PHP_EOL, $tester->getDisplay())), | ||
), | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.