Skip to content

Commit

Permalink
Ensure GithubPackageReleaseAssetsTest integration test uses GH token …
Browse files Browse the repository at this point in the history
…for API call
  • Loading branch information
asgrim committed Jan 3, 2025
1 parent 2a191c2 commit b80a8bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
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
15 changes: 11 additions & 4 deletions test/integration/Downloading/GithubPackageReleaseAssetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Php\PieIntegrationTest\Downloading;

use Composer\Config;
use Composer\IO\IOInterface;
use Composer\Factory;
use Composer\IO\BufferIO;
use Composer\Package\CompletePackage;
use Composer\Util\AuthHelper;
use Composer\Util\HttpDownloader;
Expand All @@ -22,6 +22,7 @@
use Php\Pie\Platform\WindowsCompiler;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Output\StreamOutput;

#[CoversClass(GithubPackageReleaseAssets::class)]
final class GithubPackageReleaseAssetsTest extends TestCase
Expand Down Expand Up @@ -59,8 +60,14 @@ public function testDeterminingReleaseAssetUrlForWindows(): void
99,
);

$io = $this->createMock(IOInterface::class);
$config = new Config();
$io = new BufferIO('', StreamOutput::VERBOSITY_VERY_VERBOSE);
$config = Factory::createGlobal($io)?->getConfig();
if ($config === null) {
self::fail('NOPE: ' . $io->getOutput());
}

var_dump($io->getAuthentications());

Check failure on line 69 in test/integration/Downloading/GithubPackageReleaseAssetsTest.php

View workflow job for this annotation

GitHub Actions / static-analysis

ForbiddenCode

test/integration/Downloading/GithubPackageReleaseAssetsTest.php:69:9: ForbiddenCode: Unsafe var_dump (see https://psalm.dev/002)
// self::assertTrue($io->hasAuthentication('github.com'));

self::assertSame(
'https://github.com/asgrim/example-pie-extension/releases/download/2.0.2/php_example_pie_extension-2.0.2-8.3-ts-vs16-x86_64.zip',
Expand Down

0 comments on commit b80a8bf

Please sign in to comment.