示例#1
0
 /**
  * @test
  *
  * Ensure signature is not empty
  */
 public function ensureSignatureIsNotEmpty()
 {
     $this->signature->setHttpMethod('get');
     $this->signature->setResourceURL('http://example.com/api/user');
     $this->assertNotEmpty($this->signature->sign(), 'The signature was empty');
 }
示例#2
0
 /**
  * test to ensure the set properties are in the header
  */
 public function testEnsureHeaderIsBeingCreated()
 {
     $timestamp = 1420302568;
     $nonce = '3e448845e49f46fc47335a8537333ada';
     $signature = new HmacSha1($this->consumerToken, $this->accessToken);
     $signature->setResourceURL('http://api.twitter.com/1.1/statuses/show/460095281871073282.json');
     $signature->setHttpMethod('GET');
     $signature->setNonce($nonce);
     $signature->setTimestamp($timestamp);
     $matchSignature = rawurlencode($signature->sign());
     $this->twitter->setResourceUrl('http://api.twitter.com/1.1/statuses/show/460095281871073282.json');
     $this->twitter->setHttpMethod('GET');
     $this->twitter->setNonce($nonce);
     $this->twitter->setTimestamp($timestamp);
     $header = $this->twitter->getAuthorizationHeader();
     $this->assertGreaterThan(0, strpos($header, $matchSignature), $matchSignature . ' is not in ' . $header);
     $this->assertGreaterThan(0, strpos($header, $this->accessToken->getIdentifier()));
 }