Some tests
parent
823774bf6e
commit
993add9398
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace League\OAuth2\Client\Test\Provider;
|
||||
|
||||
use Mockery as m;
|
||||
|
||||
class DropboxTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $provider;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->provider = new \League\OAuth2\Client\Provider\Dropbox([
|
||||
'clientId' => 'mock_client_id',
|
||||
'clientSecret' => 'mock_secret',
|
||||
'redirectUri' => 'none',
|
||||
]);
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
m::close();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testAuthorizationUrl()
|
||||
{
|
||||
$url = $this->provider->getAuthorizationUrl([
|
||||
'approval_prompt' => []
|
||||
]);
|
||||
$uri = parse_url($url);
|
||||
parse_str($uri['query'], $query);
|
||||
|
||||
$this->assertArrayHasKey('client_id', $query);
|
||||
$this->assertArrayHasKey('redirect_uri', $query);
|
||||
$this->assertArrayHasKey('state', $query);
|
||||
$this->assertArrayHasKey('scope', $query);
|
||||
$this->assertArrayHasKey('response_type', $query);
|
||||
$this->assertArrayNotHasKey('approval_prompt', $query);
|
||||
$this->assertNotNull($this->provider->state);
|
||||
}
|
||||
|
||||
public function testUrlAccessToken()
|
||||
{
|
||||
$url = $this->provider->urlAccessToken();
|
||||
$uri = parse_url($url);
|
||||
|
||||
$this->assertEquals('/1/oauth2/token', $uri['path']);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue