Skip to content

Commit cf69e80

Browse files
authored
Skip changelog's test when the dataprovider returns nothing (#1983)
1 parent c79ebe8 commit cf69e80

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/Unit/ChangelogTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,12 @@ public function testChangelogFormat(string $changelogPath)
131131
}
132132

133133
#[DataProvider('provideChangedServicesWithoutChangelog')]
134-
public function testChangelogEntryForService(string $service, string $base, $isCommentOnly)
134+
public function testChangelogEntryForService(string $service, string $base, bool $isCommentOnly)
135135
{
136+
if ('' === $service) {
137+
self::markTestSkipped('Nothing to test');
138+
}
139+
136140
if (!$isCommentOnly) {
137141
self::fail('Missing CHANGELOG entry for package ' . $service);
138142
}
@@ -186,7 +190,7 @@ static function ($branch) {
186190
);
187191

188192
if (0 === \count($branches)) {
189-
self::markTestSkipped('Cannot find the master branch');
193+
yield [null, null, null];
190194
}
191195

192196
usort($branches, static function ($a, $b) {
@@ -242,6 +246,7 @@ static function ($branch) {
242246
$changedServices[$service]['files'][] = $subPath;
243247
}
244248

249+
$oneChange = false;
245250
foreach ($changedServices as $service => $changesService) {
246251
$changedFiles = $changesService['files'];
247252
if (\in_array('/CHANGELOG.md', $changedFiles, true)) {
@@ -271,6 +276,10 @@ static function ($branch) {
271276
}
272277

273278
yield [$service, $changesService['base'], $isCommentOnly];
279+
$oneChange = true;
280+
}
281+
if (!$oneChange) {
282+
yield ['', '', false];
274283
}
275284
}
276285

0 commit comments

Comments
 (0)