From c679cfaca22f12cea459982eed28f8509e0e36f4 Mon Sep 17 00:00:00 2001 From: Sam Wilson Date: Wed, 18 Dec 2024 09:42:55 +0800 Subject: [PATCH] Better message when skipping tests Add info about the env vars and config filename when skipping tests. Refs #81 --- tests/TestCase.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index 7615897..cbe31f3 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -30,12 +30,13 @@ public function getFlickr(bool $authenticate = false): PhpFlickr $apiSecret = getenv('FLICKR_API_SECRET'); $accessToken = getenv('FLICKR_ACCESS_TOKEN'); $accessTokenSecret = getenv('FLICKR_ACCESS_SECRET'); - if (empty($apiKey) && file_exists(__DIR__ . '/config.php')) { - require __DIR__ . '/config.php'; + $configFile = __DIR__ . '/config.php'; + if (empty($apiKey) && file_exists($configFile)) { + require $configFile; } if (empty($apiKey)) { // Skip if no key found, so PRs from forks can still be run in CI. - static::markTestSkipped('No Flickr API key set.'); + static::markTestSkipped('No Flickr API key set (in either the FLICKR_* env vars or ' . $configFile . ')'); } try { $this->flickrs[$authed] = new PhpFlickr($apiKey, $apiSecret);