OAuth/tests/RequestTest.php
Jacob Kiers 8bd355f556 Use Interfaces anywhere.
In practice, there were still too many concrete classes, which makes
integration into a framework hard. To overcome this, the codebase has
been refactored to use Interfaces when a resource is needed.

All necessary Interfaces have been created, and the existing concrete
classes now implement these interfaces.
2013-02-11 14:02:14 +00:00

37 lines
1.4 KiB
PHP

<?php
use Mockery as m;
use JacobKiers\OAuth\Request\Request;
class RequestTest extends PHPUnit_Framework_TestCase
{
public function tearDown()
{
m::close();
}
public function testHttpMethodCanBeNormalized()
{
$request = new Request('foo', 'bar');
$this->assertEquals('FOO', $request->getNormalizedHttpMethod());
}
public function testHttpUrlCanBeNormalized()
{
$request = new Request('foo', 'bar');
$this->assertEquals('http://bar', $request->getNormalizedHttpUrl());
$request = new Request('foo', 'example.com:80');
$this->assertEquals('http://example.com', $request->getNormalizedHttpUrl());
$request = new Request('foo', 'example.com:81');
$this->assertEquals('http://example.com:81', $request->getNormalizedHttpUrl());
$request = new Request('foo', 'https://example.com');
$this->assertEquals('https://example.com', $request->getNormalizedHttpUrl());
$request = new Request('foo', 'https://example.com:443');
$this->assertEquals('https://example.com', $request->getNormalizedHttpUrl());
$request = new Request('foo', 'http://example.com/foobar');
$this->assertEquals('http://example.com/foobar', $request->getNormalizedHttpUrl());
$request = new Request('foo', 'example.org:80/foobar');
$this->assertEquals('http://example.org/foobar', $request->getNormalizedHttpUrl());
}
}