Add basic client and token unit tests.
This commit is contained in:
parent
7ef4283511
commit
1f05207957
20
tests/ClientTest.php
Normal file
20
tests/ClientTest.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use GaryJones\OAuth\Client;
|
||||||
|
|
||||||
|
class ClientTest extends PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
public function testKeyAndSecretAreSet()
|
||||||
|
{
|
||||||
|
$client = new Client('foo', 'bar');
|
||||||
|
$this->assertEquals('foo', $client->getKey());
|
||||||
|
$this->assertEquals('bar', $client->getSecret());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCallbackUrlIsSet()
|
||||||
|
{
|
||||||
|
$client = new Client('foo', 'bar', 'http://example.com/foobar');
|
||||||
|
$this->assertEquals('http://example.com/foobar', $client->getCallbackUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
22
tests/TokenTest.php
Normal file
22
tests/TokenTest.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use GaryJones\OAuth\Token;
|
||||||
|
use GaryJones\OAuth\Util;
|
||||||
|
|
||||||
|
class TokenTest extends PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
public function testKeyAndSecretAreSet()
|
||||||
|
{
|
||||||
|
$token = new Token('foo', 'bar');
|
||||||
|
$this->assertEquals('foo', $token->getKey());
|
||||||
|
$this->assertEquals('bar', $token->getSecret());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testTokenString()
|
||||||
|
{
|
||||||
|
$token = new Token('foo', 'bar');
|
||||||
|
$string = 'oauth_token=' . Util::urlencodeRfc3986('foo') .
|
||||||
|
'&oauth_token_secret=' . Util::urlencodeRfc3986('bar');
|
||||||
|
$this->assertEquals($string, $token->toString());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user