Added tests for new required 'oauth_consumer_key'.
Signed-off-by: Jacob Kiers <jacob@jacobkiers.net>
This commit is contained in:
parent
e4e8bc2f90
commit
f8ffcd6f87
@ -10,27 +10,34 @@ class RequestTest extends PHPUnit_Framework_TestCase
|
||||
m::close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \JacobKiers\OAuth\OAuthException
|
||||
*/
|
||||
public function testRequestThrowsExceptionWhenNoOAuthConsumerKeyIsPresent()
|
||||
{
|
||||
$request = new Request('POST', 'http://example.com', array());
|
||||
}
|
||||
public function testHttpMethodCanBeNormalized()
|
||||
{
|
||||
$request = new Request('foo', 'bar');
|
||||
$request = new Request('foo', 'bar', array('oauth_consumer_key' => 'bar'));
|
||||
$this->assertEquals('FOO', $request->getNormalizedHttpMethod());
|
||||
}
|
||||
|
||||
public function testHttpUrlCanBeNormalized()
|
||||
{
|
||||
$request = new Request('foo', 'bar');
|
||||
$request = new Request('foo', 'bar', array('oauth_consumer_key' => 'bar'));
|
||||
$this->assertEquals('http://bar', $request->getNormalizedHttpUrl());
|
||||
$request = new Request('foo', 'example.com:80');
|
||||
$request = new Request('foo', 'example.com:80', array('oauth_consumer_key' => 'bar'));
|
||||
$this->assertEquals('http://example.com', $request->getNormalizedHttpUrl());
|
||||
$request = new Request('foo', 'example.com:81');
|
||||
$request = new Request('foo', 'example.com:81', array('oauth_consumer_key' => 'bar'));
|
||||
$this->assertEquals('http://example.com:81', $request->getNormalizedHttpUrl());
|
||||
$request = new Request('foo', 'https://example.com');
|
||||
$request = new Request('foo', 'https://example.com', array('oauth_consumer_key' => 'bar'));
|
||||
$this->assertEquals('https://example.com', $request->getNormalizedHttpUrl());
|
||||
$request = new Request('foo', 'https://example.com:443');
|
||||
$request = new Request('foo', 'https://example.com:443', array('oauth_consumer_key' => 'bar'));
|
||||
$this->assertEquals('https://example.com', $request->getNormalizedHttpUrl());
|
||||
$request = new Request('foo', 'http://example.com/foobar');
|
||||
$request = new Request('foo', 'http://example.com/foobar', array('oauth_consumer_key' => 'bar'));
|
||||
$this->assertEquals('http://example.com/foobar', $request->getNormalizedHttpUrl());
|
||||
$request = new Request('foo', 'example.org:80/foobar');
|
||||
$request = new Request('foo', 'example.org:80/foobar', array('oauth_consumer_key' => 'bar'));
|
||||
$this->assertEquals('http://example.org/foobar', $request->getNormalizedHttpUrl());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user