Skip to content

Commit

Permalink
Merge pull request #171 from asgrim/ensure-github-token-used-in-integ…
Browse files Browse the repository at this point in the history
…ration-test

Ensure GithubPackageReleaseAssetsTest integration test uses GH token
  • Loading branch information
asgrim authored Jan 3, 2025
2 parents 2a191c2 + 805476b commit a53b255
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- run: composer config --global github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
# temporarily remove Psalm until ready for PHP 8.4
- name: remove psalm
if: matrix.php-versions == '8.4'
Expand Down
14 changes: 13 additions & 1 deletion test/integration/Downloading/GithubPackageReleaseAssetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;

use function getenv;
use function is_string;

#[CoversClass(GithubPackageReleaseAssets::class)]
final class GithubPackageReleaseAssetsTest extends TestCase
{
Expand Down Expand Up @@ -59,7 +62,16 @@ public function testDeterminingReleaseAssetUrlForWindows(): void
99,
);

$io = $this->createMock(IOInterface::class);
$io = $this->createMock(IOInterface::class);

$githubToken = getenv('GITHUB_TOKEN');
if (is_string($githubToken) && $githubToken !== '') {
$io->method('hasAuthentication')
->willReturn(true);
$io->method('getAuthentication')
->willReturn(['username' => $githubToken, 'password' => 'x-oauth-basic']);
}

$config = new Config();

self::assertSame(
Expand Down

0 comments on commit a53b255

Please sign in to comment.