KeyStoreTest.php 558 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace HttpSignatures\tests;
  3. use HttpSignatures\KeyStore;
  4. class KeyStoreTest extends \PHPUnit_Framework_TestCase
  5. {
  6. public function testFetchSuccess()
  7. {
  8. $ks = new KeyStore(['id' => 'secret']);
  9. $key = $ks->fetch('id');
  10. $this->assertEquals('id', $key->id);
  11. $this->assertEquals('secret', $key->secret);
  12. }
  13. /**
  14. * @expectedException HttpSignatures\Exception
  15. */
  16. public function testFetchFail()
  17. {
  18. $ks = new KeyStore(['id' => 'secret']);
  19. $key = $ks->fetch('nope');
  20. }
  21. }