Skip to content

Commit

Permalink
Merge pull request #386 from Roave/fix-missing-skipped-from-markdown-…
Browse files Browse the repository at this point in the history
…output

[6.0.x] Fixed Markdown output not returning skipped items
  • Loading branch information
Ocramius authored Jan 3, 2022
2 parents 316285b + 3abb3c9 commit 7658d00
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
"sort-packages": true,
"platform": {
"php": "8.0.99"
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"infection/extension-installer": true
}
}
}
9 changes: 8 additions & 1 deletion src/Formatter/MarkdownPipedToSymfonyConsoleFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
), '')
);
}

Expand All @@ -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";
}
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace RoaveTest\BackwardCompatibility\Formatter;

use Exception;
use PHPUnit\Framework\TestCase;
use Roave\BackwardCompatibility\Change;
use Roave\BackwardCompatibility\Changes;
Expand Down Expand Up @@ -32,6 +33,9 @@ public function testWrite(): void
- [BC] Something removed
- Something removed
# Skipped
- [BC] A failure happened
EOF;

$output->expects(self::once())
Expand All @@ -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')),
));
}
}

0 comments on commit 7658d00

Please sign in to comment.