1 <?php //vim: foldmethod=marker
2 namespace PayPal\Auth\Oauth;
3 class MockOAuthDataStore extends OAuthDataStore {/*{{{*/
5 private $request_token;
9 function __construct() {/*{{{*/
10 $this->consumer = new OAuthConsumer("key", "secret", NULL);
11 $this->request_token = new OAuthToken("requestkey", "requestsecret", 1);
12 $this->access_token = new OAuthToken("accesskey", "accesssecret", 1);
13 $this->nonce = "nonce";
16 function lookup_consumer($consumer_key) {/*{{{*/
17 if ($consumer_key == $this->consumer->key) return $this->consumer;
21 function lookup_token($consumer, $token_type, $token) {/*{{{*/
22 $token_attrib = $token_type . "_token";
23 if ($consumer->key == $this->consumer->key
24 && $token == $this->$token_attrib->key) {
25 return $this->$token_attrib;
30 function lookup_nonce($consumer, $token, $nonce, $timestamp) {/*{{{*/
31 if ($consumer->key == $this->consumer->key
32 && (($token && $token->key == $this->request_token->key)
33 || ($token && $token->key == $this->access_token->key))
34 && $nonce == $this->nonce) {
40 function new_request_token($consumer, $callback = NULL) {/*{{{*/
41 if ($consumer->key == $this->consumer->key) {
42 return $this->request_token;
47 function new_access_token($token, $consumer, $verifier = NULL) {/*{{{*/
48 if ($consumer->key == $this->consumer->key
49 && $token->key == $this->request_token->key) {
50 return $this->access_token;