diff --git a/composer.json b/composer.json index ecf7d863..becd45ac 100644 --- a/composer.json +++ b/composer.json @@ -52,6 +52,10 @@ "sort-packages": true, "platform": { "php": "8.0.99" + }, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true, + "infection/extension-installer": true } } } diff --git a/src/Formatter/MarkdownPipedToSymfonyConsoleFormatter.php b/src/Formatter/MarkdownPipedToSymfonyConsoleFormatter.php index 2932c555..edc706ec 100644 --- a/src/Formatter/MarkdownPipedToSymfonyConsoleFormatter.php +++ b/src/Formatter/MarkdownPipedToSymfonyConsoleFormatter.php @@ -45,6 +45,13 @@ static function (Change $change): bool { }, ...$arrayOfChanges ), '') + . "\n# Skipped\n" + . Str\join($this->convertFilteredChangesToMarkdownBulletList( + static function (Change $change): bool { + return $change->isSkipped(); + }, + ...$arrayOfChanges + ), '') ); } @@ -58,7 +65,7 @@ private function convertFilteredChangesToMarkdownBulletList(callable $filterFunc return Vec\map( Vec\filter($changes, $filterFunction), static function (Change $change): string { - return ' - ' . Str\replace_every(Str\trim($change->__toString()), ['ADDED: ' => '', 'CHANGED: ' => '', 'REMOVED: ' => '']) . "\n"; + return ' - ' . Str\replace_every(Str\trim($change->__toString()), ['ADDED: ' => '', 'CHANGED: ' => '', 'REMOVED: ' => '', 'SKIPPED: ' => '']) . "\n"; } ); } diff --git a/test/unit/Formatter/MarkdownPipedToSymfonyConsoleFormatterTest.php b/test/unit/Formatter/MarkdownPipedToSymfonyConsoleFormatterTest.php index dd988b7b..382c21ce 100644 --- a/test/unit/Formatter/MarkdownPipedToSymfonyConsoleFormatterTest.php +++ b/test/unit/Formatter/MarkdownPipedToSymfonyConsoleFormatterTest.php @@ -4,6 +4,7 @@ namespace RoaveTest\BackwardCompatibility\Formatter; +use Exception; use PHPUnit\Framework\TestCase; use Roave\BackwardCompatibility\Change; use Roave\BackwardCompatibility\Changes; @@ -32,6 +33,9 @@ public function testWrite(): void - [BC] Something removed - Something removed +# Skipped + - [BC] A failure happened + EOF; $output->expects(self::once()) @@ -46,7 +50,8 @@ public function testWrite(): void Change::changed('Something changed', true), Change::changed('Something changed', false), Change::removed('Something removed', true), - Change::removed('Something removed', false) + Change::removed('Something removed', false), + Change::skippedDueToFailure(new Exception('A failure happened')), )); } }