2018-01-28 18:17:19 +01:00
|
|
|
<?php
|
|
|
|
|
2021-09-13 20:51:12 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2018-01-28 18:17:19 +01:00
|
|
|
namespace Abraham\TwitterOAuth\Tests;
|
|
|
|
|
2021-09-13 20:51:12 +02:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2018-01-28 18:17:19 +01:00
|
|
|
use Abraham\TwitterOAuth\Token;
|
|
|
|
|
2021-09-13 20:51:12 +02:00
|
|
|
class TokenTest extends TestCase
|
|
|
|
{
|
2018-01-28 18:17:19 +01: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 20:51:12 +02: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 18:17:19 +01:00
|
|
|
];
|
|
|
|
}
|
2021-09-13 20:51:12 +02:00
|
|
|
}
|