mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +00:00
Fix PSR-0 file naming
This commit is contained in:
69
tests/classes/api/oauthv2/AuthCodeTest.php
Normal file
69
tests/classes/api/oauthv2/AuthCodeTest.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
class api_oauthv2_AuthCodeTest extends \PhraseanetTestCase
|
||||
{
|
||||
/**
|
||||
* @var API_OAuth2_AuthCode
|
||||
*/
|
||||
protected $object;
|
||||
protected $code;
|
||||
|
||||
protected $account;
|
||||
protected $application;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->account = API_OAuth2_Account::load_with_user(self::$DI['app'], self::$DI['oauth2-app-user'], self::$DI['user']);
|
||||
$expires = time() + 100;
|
||||
$this->code = random::generatePassword(8);
|
||||
$this->object = API_OAuth2_AuthCode::create(self::$DI['app'], $this->account, $this->code, $expires);
|
||||
}
|
||||
|
||||
public function testGet_code()
|
||||
{
|
||||
$this->assertEquals($this->code, $this->object->get_code());
|
||||
}
|
||||
|
||||
public function testGet_account()
|
||||
{
|
||||
$this->assertInstanceOf('API_OAuth2_Account', $this->object->get_account());
|
||||
}
|
||||
|
||||
public function testGet_redirect_uri()
|
||||
{
|
||||
$this->assertEquals('', $this->object->get_redirect_uri());
|
||||
}
|
||||
|
||||
public function testSet_redirect_uri()
|
||||
{
|
||||
$redirect_uri = 'https://www.google.com';
|
||||
$this->assertEquals('', $this->object->get_redirect_uri());
|
||||
$this->object->set_redirect_uri($redirect_uri);
|
||||
$this->assertEquals($redirect_uri, $this->object->get_redirect_uri());
|
||||
}
|
||||
|
||||
public function testGet_expires()
|
||||
{
|
||||
$this->assertInternalType('string', $this->object->get_expires());
|
||||
}
|
||||
|
||||
public function testGet_scope()
|
||||
{
|
||||
$this->assertEquals('', $this->object->get_scope());
|
||||
}
|
||||
|
||||
public function testSet_scope()
|
||||
{
|
||||
$scope = 'prout';
|
||||
$this->assertEquals('', $this->object->get_scope());
|
||||
$this->object->set_scope($scope);
|
||||
$this->assertEquals($scope, $this->object->get_scope());
|
||||
}
|
||||
|
||||
public function testLoad_codes_by_account()
|
||||
{
|
||||
$this->assertTrue(is_array(API_OAuth2_AuthCode::load_codes_by_account(self::$DI['app'], $this->account)));
|
||||
$this->assertTrue(count(API_OAuth2_AuthCode::load_codes_by_account(self::$DI['app'], $this->account)) > 0);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user