OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
firebase
/
vendor
/
kreait
/
firebase-tokens
/
tests
/
Firebase
/
Auth
/
Token
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/12/2024 10:36:29 AM
rwxr-xr-x
📁
Cache
-
08/12/2024 10:36:42 AM
rwxr-xr-x
📄
GeneratorTest.php
1.87 KB
08/12/2024 10:36:30 AM
rw-r--r--
📄
HttpKeyStoreTest.php
1.66 KB
08/12/2024 10:36:30 AM
rw-r--r--
📄
TenantAwareGeneratorTest.php
2.33 KB
08/12/2024 10:36:30 AM
rw-r--r--
📄
TenantAwareVerifierTest.php
2.46 KB
08/12/2024 10:36:30 AM
rw-r--r--
📄
TestCase.php
1010 bytes
08/12/2024 10:36:30 AM
rw-r--r--
📁
Util
-
08/12/2024 10:36:42 AM
rwxr-xr-x
📄
VerifierTest.php
5.32 KB
08/12/2024 10:36:30 AM
rw-r--r--
Editing: HttpKeyStoreTest.php
Close
<?php declare(strict_types=1); namespace Firebase\Auth\Token\Tests; use Firebase\Auth\Token\HttpKeyStore; use OutOfBoundsException; use PHPUnit\Framework\MockObject\MockObject; use Psr\SimpleCache\CacheInterface; /** * @internal */ class HttpKeyStoreTest extends TestCase { private HttpKeyStore $store; /** @var array<string, string> */ private static array $liveKeys; /** @var CacheInterface|MockObject */ private $cache; public static function setUpBeforeClass(): void { $keys = []; foreach (HttpKeyStore::KEY_URLS as $url) { foreach ((array) \json_decode((string) \file_get_contents($url), true) as $keyId => $key) { $keys[$keyId] = $key; } } self::$liveKeys = $keys; } protected function setUp(): void { $this->cache = $this->createMock(CacheInterface::class); $this->store = new HttpKeyStore(null, $this->cache); } public function testGetKeyFromGoogle(): void { $keyId = \array_rand(self::$liveKeys); $key = self::$liveKeys[$keyId]; $this->assertEquals($key, $this->store->get($keyId)); } public function testGetNonExistingKey(): void { $this->expectException(OutOfBoundsException::class); $this->store->get('non_existing'); } public function testGetKeyFromCache(): void { $this->cache->expects($this->once()) ->method('get') ->with($this->anything()) ->willReturn(['foo' => 'bar']) ; $this->assertSame('bar', $this->store->get('foo')); } }