mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
30 lines
748 B
PHP
30 lines
748 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace SPC\Tests\store;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use SPC\store\CurlHook;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
class CurlHookTest extends TestCase
|
|
{
|
|
public function testSetupGithubToken()
|
|
{
|
|
$header = [];
|
|
CurlHook::setupGithubToken('GET', 'https://example.com', $header);
|
|
if (getenv('GITHUB_TOKEN') === false) {
|
|
$this->assertEmpty($header);
|
|
} else {
|
|
$this->assertEquals(['Authorization: Bearer ' . getenv('GITHUB_TOKEN')], $header);
|
|
}
|
|
$header = [];
|
|
putenv('GITHUB_TOKEN=token');
|
|
CurlHook::setupGithubToken('GET', 'https://example.com', $header);
|
|
$this->assertEquals(['Authorization: Bearer token'], $header);
|
|
}
|
|
}
|