-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from scoutapp/ci-fix-env
Fix missing env in CI
- Loading branch information
Showing
6 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Scoutapm\IntegrationTests; | ||
|
||
use PHPUnit\Framework\TestListener; | ||
use PHPUnit\Framework\TestListenerDefaultImplementation; | ||
use PHPUnit\Framework\TestSuite; | ||
use function getenv; | ||
use function sprintf; | ||
use function str_repeat; | ||
use function strlen; | ||
use function substr; | ||
|
||
final class CheckScoutApmKeyListener implements TestListener | ||
{ | ||
/** @var bool */ | ||
private $hasOutput = false; | ||
|
||
private const SHOW_CHARACTERS_OF_KEY = 2; | ||
use TestListenerDefaultImplementation; | ||
|
||
public function startTestSuite(TestSuite $suite) : void | ||
{ | ||
if ($this->hasOutput) { | ||
return; | ||
} | ||
|
||
$scoutApmKey = getenv('SCOUT_APM_KEY'); | ||
|
||
if ($scoutApmKey === false || $scoutApmKey === '') { | ||
echo "Running without SCOUT_APM_KEY configured, some tests will be skipped.\n\n"; | ||
$this->hasOutput = true; | ||
|
||
return; | ||
} | ||
|
||
echo sprintf( | ||
"Running with SCOUT_APM_KEY set %s%s\n\n", | ||
substr($scoutApmKey, 0, self::SHOW_CHARACTERS_OF_KEY), | ||
str_repeat('*', strlen($scoutApmKey) - self::SHOW_CHARACTERS_OF_KEY) | ||
); | ||
$this->hasOutput = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters