Skip to content

Commit a53b255

Browse files
authored
Merge pull request #171 from asgrim/ensure-github-token-used-in-integration-test
Ensure GithubPackageReleaseAssetsTest integration test uses GH token
2 parents 2a191c2 + 805476b commit a53b255

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
env:
3030
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3131
- uses: actions/checkout@v4
32+
- run: composer config --global github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
3233
# temporarily remove Psalm until ready for PHP 8.4
3334
- name: remove psalm
3435
if: matrix.php-versions == '8.4'

test/integration/Downloading/GithubPackageReleaseAssetsTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
use PHPUnit\Framework\Attributes\CoversClass;
2424
use PHPUnit\Framework\TestCase;
2525

26+
use function getenv;
27+
use function is_string;
28+
2629
#[CoversClass(GithubPackageReleaseAssets::class)]
2730
final class GithubPackageReleaseAssetsTest extends TestCase
2831
{
@@ -59,7 +62,16 @@ public function testDeterminingReleaseAssetUrlForWindows(): void
5962
99,
6063
);
6164

62-
$io = $this->createMock(IOInterface::class);
65+
$io = $this->createMock(IOInterface::class);
66+
67+
$githubToken = getenv('GITHUB_TOKEN');
68+
if (is_string($githubToken) && $githubToken !== '') {
69+
$io->method('hasAuthentication')
70+
->willReturn(true);
71+
$io->method('getAuthentication')
72+
->willReturn(['username' => $githubToken, 'password' => 'x-oauth-basic']);
73+
}
74+
6375
$config = new Config();
6476

6577
self::assertSame(

0 commit comments

Comments
 (0)