oauth2-client/test/src/ClientCredentialsTest.php

26 lines
722 B
PHP

<?php
namespace OAuth2\Test;
class ClientCredentialsTest extends \PHPUnit_Framework_TestCase
{
protected $provider;
protected function setUp()
{
$this->provider = new \OAuth2\Google(array(
'clientId' => 'mock_client_id',
'clientSecret' => 'mock_secret',
'redirectUri' => 'none',
));
}
public function testGetAccessToken()
{
\OAuth2\CurlMock::addPendingResponse(true, "200 OK", '', '{"access_token": "mock_access_token", "expires": 3600, "refresh_token": "mock_refresh_token", "uid": 1}');
$token = $this->provider->getAccessToken('client_credentials');
$this->assertInstanceOf('\OAuth2\AccessToken', $token);
}
}