2018-01-28 17:17:19 +00:00
|
|
|
<?php
|
|
|
|
|
2021-09-13 18:51:12 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2018-01-28 17:17:19 +00:00
|
|
|
namespace Abraham\TwitterOAuth\Tests;
|
|
|
|
|
2021-09-13 18:51:12 +00:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2018-01-28 17:17:19 +00:00
|
|
|
use Abraham\TwitterOAuth\Token;
|
|
|
|
|
2021-09-13 18:51:12 +00:00
|
|
|
class TokenTest extends TestCase
|
|
|
|
{
|
2018-01-28 17:17:19 +00:00
|
|
|
/**
|
|
|
|
* @dataProvider tokenProvider
|
|
|
|
*/
|
|
|
|
public function testToString($expected, $key, $secret)
|
|
|
|
{
|
|
|
|
$token = new Token($key, $secret);
|
|
|
|
|
|
|
|
$this->assertEquals($expected, $token->__toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function tokenProvider()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
['oauth_token=key&oauth_token_secret=secret', 'key', 'secret'],
|
2021-09-13 18:51:12 +00:00
|
|
|
[
|
|
|
|
'oauth_token=key%2Bkey&oauth_token_secret=secret',
|
|
|
|
'key+key',
|
|
|
|
'secret',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'oauth_token=key~key&oauth_token_secret=secret',
|
|
|
|
'key~key',
|
|
|
|
'secret',
|
|
|
|
],
|
2018-01-28 17:17:19 +00:00
|
|
|
];
|
|
|
|
}
|
2021-09-13 18:51:12 +00:00
|
|
|
}
|