You are here

class JWKTest in Auth0 Single Sign On 8.2

Hierarchy

  • class \Auth0\Tests\API\ApiTests extends \Auth0\Tests\API\PHPUnit_Framework_TestCase uses ErrorHelpers
    • class \Auth0\Tests\Api\Helpers\JWKTest

Expanded class hierarchy of JWKTest

File

vendor/auth0/auth0-php/tests/API/Helpers/JWKTests.php, line 10

Namespace

Auth0\Tests\Api\Helpers
View source
class JWKTest extends ApiTests {
  public function testNoCache() {
    $env = self::getEnv();
    $cache = new CacheDecorator(new NoCacheHandler());
    $fetcher = new JWKFetcher($cache);
    $keys = $fetcher
      ->fetchKeys($env['DOMAIN']);
    $this
      ->assertTrue(is_array($keys));
    $keys = $fetcher
      ->fetchKeys($env['DOMAIN']);
    $this
      ->assertTrue(is_array($keys));
    $this
      ->assertEquals(2, $cache
      ->count('get'));
    $this
      ->assertEquals(2, $cache
      ->count('set'));
    $this
      ->assertEquals(0, $cache
      ->count('delete'));
  }
  public function testFileSystemCache() {
    $env = self::getEnv();
    $cache = new CacheDecorator(new FileSystemCacheHandler(md5(uniqid())));
    $fetcher = new JWKFetcher($cache);
    $keys = $fetcher
      ->fetchKeys($env['DOMAIN']);
    $this
      ->assertTrue(is_array($keys));
    $keys = $fetcher
      ->fetchKeys($env['DOMAIN']);
    $this
      ->assertTrue(is_array($keys));
    $this
      ->assertEquals(2, $cache
      ->count('get'));
    $this
      ->assertEquals(1, $cache
      ->count('set'));
    $this
      ->assertEquals(0, $cache
      ->count('delete'));
    $cache
      ->delete('auth0-php.auth0.com.well-known/jwks.json');
    $keys = $fetcher
      ->fetchKeys($env['DOMAIN']);
    $this
      ->assertTrue(is_array($keys));
    $this
      ->assertEquals(3, $cache
      ->count('get'));
    $this
      ->assertEquals(2, $cache
      ->count('set'));
    $this
      ->assertEquals(1, $cache
      ->count('delete'));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ApiTests::$env protected static property Environment variables.
ApiTests::getEnv protected static function Get all test suite environment variables.
ErrorHelpers::errorHasString protected function Does an error message contain a specific string?
JWKTest::testFileSystemCache public function
JWKTest::testNoCache public function