From f060ed23998b5ee89d914dfd86ed089c97b6d2ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Fri, 7 Nov 2025 12:56:01 +0100 Subject: [PATCH] Skip changelog's test when the dataprovider returns nothing --- tests/Unit/ChangelogTest.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/Unit/ChangelogTest.php b/tests/Unit/ChangelogTest.php index 378540e69..15e24855b 100644 --- a/tests/Unit/ChangelogTest.php +++ b/tests/Unit/ChangelogTest.php @@ -131,8 +131,12 @@ public function testChangelogFormat(string $changelogPath) } #[DataProvider('provideChangedServicesWithoutChangelog')] - public function testChangelogEntryForService(string $service, string $base, $isCommentOnly) + public function testChangelogEntryForService(string $service, string $base, bool $isCommentOnly) { + if ('' === $service) { + self::markTestSkipped('Nothing to test'); + } + if (!$isCommentOnly) { self::fail('Missing CHANGELOG entry for package ' . $service); } @@ -186,7 +190,7 @@ static function ($branch) { ); if (0 === \count($branches)) { - self::markTestSkipped('Cannot find the master branch'); + yield [null, null, null]; } usort($branches, static function ($a, $b) { @@ -242,6 +246,7 @@ static function ($branch) { $changedServices[$service]['files'][] = $subPath; } + $oneChange = false; foreach ($changedServices as $service => $changesService) { $changedFiles = $changesService['files']; if (\in_array('/CHANGELOG.md', $changedFiles, true)) { @@ -271,6 +276,10 @@ static function ($branch) { } yield [$service, $changesService['base'], $isCommentOnly]; + $oneChange = true; + } + if (!$oneChange) { + yield ['', '', false]; } }