Skip to content

Commit

Permalink
Better message when skipping tests
Browse files Browse the repository at this point in the history
Add info about the env vars and config filename when skipping tests.

Refs #81
  • Loading branch information
samwilson authored Dec 18, 2024
1 parent 70f4ff9 commit c679cfa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c679cfa

Please sign in to comment.