Example #1
0
 /**
  * @test
  *
  * Test to ensure that the Plaintext signature is created correctly
  */
 public function ensurePlaintextSignatureIsCreatedCorrectly()
 {
     $expectedSignature = rawurlencode($this->consumer->getSecret());
     $expectedSignature .= '&';
     $expectedSignature .= rawurlencode($this->user->getSecret());
     $plaintextSignature = new Plaintext($this->consumer, $this->user);
     $signature = $plaintextSignature->sign();
     $this->assertEquals($expectedSignature, $signature);
 }
Example #2
0
 /**
  * @test
  *
  * Test to ensure plaintext signature is added to the header
  */
 public function verifyPlaintextSignatureIsAdded()
 {
     $expectedSignature = rawurlencode($this->consumer->getSecret());
     $expectedSignature .= '%26';
     $expectedSignature .= rawurlencode($this->user->getSecret());
     $this->plaintext->setHttpMethod('get');
     $this->plaintext->setResourceURL('https://example.com/api');
     $this->plaintext->setNonce('123456');
     $header = new Header();
     $header->setSignature($this->plaintext);
     $headerString = $header->createAuthorizationHeader();
     $this->assertContains($expectedSignature, $headerString, 'Signature was not found');
     $this->assertContains('OAuth', $headerString, 'OAuth Authorization type not found');
     $this->assertContains('oauth_nonce="123456"', $headerString, 'Nonce not found');
 }