OAuthTokenTest.php 738 B

1234567891011121314151617181920
  1. <?php
  2. require_once 'common.php';
  3. class OAuthTokenTest extends PHPUnit_Framework_TestCase {
  4. public function testSerialize() {
  5. $token = new OAuthToken('token', 'secret');
  6. $this->assertEquals('oauth_token=token&oauth_token_secret=secret', $token->to_string());
  7. $token = new OAuthToken('token&', 'secret%');
  8. $this->assertEquals('oauth_token=token%26&oauth_token_secret=secret%25', $token->to_string());
  9. }
  10. public function testConvertToString() {
  11. $token = new OAuthToken('token', 'secret');
  12. $this->assertEquals('oauth_token=token&oauth_token_secret=secret', (string) $token);
  13. $token = new OAuthToken('token&', 'secret%');
  14. $this->assertEquals('oauth_token=token%26&oauth_token_secret=secret%25', (string) $token);
  15. }
  16. }