Skip to content

Commit 7658d00

Browse files
authored
Merge pull request #386 from Roave/fix-missing-skipped-from-markdown-output
[6.0.x] Fixed Markdown output not returning skipped items
2 parents 316285b + 3abb3c9 commit 7658d00

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
"sort-packages": true,
5353
"platform": {
5454
"php": "8.0.99"
55+
},
56+
"allow-plugins": {
57+
"dealerdirect/phpcodesniffer-composer-installer": true,
58+
"infection/extension-installer": true
5559
}
5660
}
5761
}

src/Formatter/MarkdownPipedToSymfonyConsoleFormatter.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ static function (Change $change): bool {
4545
},
4646
...$arrayOfChanges
4747
), '')
48+
. "\n# Skipped\n"
49+
. Str\join($this->convertFilteredChangesToMarkdownBulletList(
50+
static function (Change $change): bool {
51+
return $change->isSkipped();
52+
},
53+
...$arrayOfChanges
54+
), '')
4855
);
4956
}
5057

@@ -58,7 +65,7 @@ private function convertFilteredChangesToMarkdownBulletList(callable $filterFunc
5865
return Vec\map(
5966
Vec\filter($changes, $filterFunction),
6067
static function (Change $change): string {
61-
return ' - ' . Str\replace_every(Str\trim($change->__toString()), ['ADDED: ' => '', 'CHANGED: ' => '', 'REMOVED: ' => '']) . "\n";
68+
return ' - ' . Str\replace_every(Str\trim($change->__toString()), ['ADDED: ' => '', 'CHANGED: ' => '', 'REMOVED: ' => '', 'SKIPPED: ' => '']) . "\n";
6269
}
6370
);
6471
}

test/unit/Formatter/MarkdownPipedToSymfonyConsoleFormatterTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace RoaveTest\BackwardCompatibility\Formatter;
66

7+
use Exception;
78
use PHPUnit\Framework\TestCase;
89
use Roave\BackwardCompatibility\Change;
910
use Roave\BackwardCompatibility\Changes;
@@ -32,6 +33,9 @@ public function testWrite(): void
3233
- [BC] Something removed
3334
- Something removed
3435
36+
# Skipped
37+
- [BC] A failure happened
38+
3539
EOF;
3640

3741
$output->expects(self::once())
@@ -46,7 +50,8 @@ public function testWrite(): void
4650
Change::changed('Something changed', true),
4751
Change::changed('Something changed', false),
4852
Change::removed('Something removed', true),
49-
Change::removed('Something removed', false)
53+
Change::removed('Something removed', false),
54+
Change::skippedDueToFailure(new Exception('A failure happened')),
5055
));
5156
}
5257
}

0 commit comments

Comments
 (0)