Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame^] | 1 | <?php |
| 2 | |
| 3 | namespace OAuth2\Storage; |
| 4 | |
| 5 | class 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 | } |