blob: f85195870b9d975a1728d60efced3b43d4f612d0 [file] [log] [blame]
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001<?php
2
3namespace OAuth2\Storage;
4
5class PublicKeyTest extends BaseTest
6{
7 /** @dataProvider provideStorage */
8 public function testSetAccessToken($storage)
9 {
10 if ($storage instanceof NullStorage) {
11 $this->markTestSkipped('Skipped Storage: ' . $storage->getMessage());
12
13 return;
14 }
15
16 if (!$storage instanceof PublicKeyInterface) {
17 // incompatible storage
18 return;
19 }
20
21 $configDir = Bootstrap::getInstance()->getConfigDir();
22 $globalPublicKey = file_get_contents($configDir.'/keys/id_rsa.pub');
23 $globalPrivateKey = file_get_contents($configDir.'/keys/id_rsa');
24
25 /* assert values from storage */
26 $this->assertEquals($storage->getPublicKey(), $globalPublicKey);
27 $this->assertEquals($storage->getPrivateKey(), $globalPrivateKey);
28 }
29}