/** * @covers OAuth\OAuth1\Signature\Signature::__construct * @covers OAuth\OAuth1\Signature\Signature::setHashingAlgorithm * @covers OAuth\OAuth1\Signature\Signature::setTokenSecret * @covers OAuth\OAuth1\Signature\Signature::getSignature * @covers OAuth\OAuth1\Signature\Signature::buildSignatureDataString * @covers OAuth\OAuth1\Signature\Signature::hash * @covers OAuth\OAuth1\Signature\Signature::getSigningKey */ public function testGetSignatureWithBarePathWithExplicitTrailingHostSlash() { $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); $credentials->expects($this->any())->method('getConsumerSecret')->will($this->returnValue('foo')); $signature = new Signature($credentials); $signature->setHashingAlgorithm('HMAC-SHA1'); $signature->setTokenSecret('foo'); $uri = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); $uri->expects($this->any())->method('getQuery')->will($this->returnValue('param1=value1')); $uri->expects($this->any())->method('getScheme')->will($this->returnValue('http')); $uri->expects($this->any())->method('getRawAuthority')->will($this->returnValue('peehaa:pass')); $uri->expects($this->any())->method('getPath')->will($this->returnValue('/')); $uri->expects($this->any())->method('hasExplicitTrailingHostSlash')->will($this->returnValue(true)); $this->assertSame('IEhUsArSTLvbQ3QYr0zzn+Rxpjg=', $signature->getSignature($uri, array('pee' => 'haa'))); }
/** * @covers OAuth\OAuth1\Signature\Signature::__construct * @covers OAuth\OAuth1\Signature\Signature::setHashingAlgorithm * @covers OAuth\OAuth1\Signature\Signature::setTokenSecret * @covers OAuth\OAuth1\Signature\Signature::getSignature * @covers OAuth\OAuth1\Signature\Signature::buildSignatureDataString * @covers OAuth\OAuth1\Signature\Signature::hash * @covers OAuth\OAuth1\Signature\Signature::getSigningKey */ public function testGetSignatureWithBarePathWithExplicitTrailingHostSlash() { $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); $credentials->expects($this->any())->method('getConsumerSecret')->will($this->returnValue('foo')); $signature = new Signature($credentials); $signature->setHashingAlgorithm('HMAC-SHA1'); $signature->setTokenSecret('foo'); $uri = new Url('http://*****:*****@nohost/?param1=value1'); $this->assertSame('evVuRC7y4Ozstd7S4ysBzJ2iymk=', $signature->getSignature($uri, ['pee' => 'haa'])); }