OAuth/tests/TokenTest.php

31 lines
853 B
PHP
Raw Permalink Normal View History

2012-11-22 13:18:56 +00:00
<?php
use JacobKiers\OAuth\Token\Token;
use JacobKiers\OAuth\Token\NullToken;
2013-02-08 10:32:26 +00:00
use JacobKiers\OAuth\Util;
2012-11-22 13:18:56 +00:00
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());
}
2012-11-23 12:20:23 +00:00
public function testNullTokenKeyAndSecretAreEmpty()
{
$token = new NullToken();
$this->assertEmpty($token->getKey());
$this->assertEmpty($token->getSecret());
}
2012-11-22 13:18:56 +00:00
}