mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 14:03:27 +00:00
@@ -15,7 +15,7 @@ class Audio extends Provider
|
||||
{
|
||||
const OPTION_BITRATE = 'bitrate';
|
||||
const OPTION_THREADS = 'threads';
|
||||
const OPTION_ACODEC = 'a_codec';
|
||||
const OPTION_ACODEC = 'acodec';
|
||||
const OPTION_AUDIOSAMPLERATE = 'audiosamplerate';
|
||||
|
||||
public function __construct()
|
||||
|
@@ -304,10 +304,12 @@ class API_OAuth2_Token
|
||||
(oauth_token, session_id, api_account_id, expires, scope)
|
||||
VALUES (:token, null, :account_id, :expire, :scope)';
|
||||
|
||||
$expires = new \DateTime('+1 hour');
|
||||
|
||||
$params = array(
|
||||
':token' => self::generate_token()
|
||||
, ':account_id' => $account->get_id()
|
||||
, ':expire' => time() + 3600
|
||||
, ':expire' => $expires->format(DATE_ISO8601)
|
||||
, ':scope' => $scope
|
||||
);
|
||||
|
||||
|
@@ -149,10 +149,10 @@ class databox_subdef
|
||||
if ($sd->size) {
|
||||
$video->setOptionValue(Video::OPTION_SIZE, (int) $sd->size);
|
||||
}
|
||||
if ($sd->a_codec) {
|
||||
if ($sd->acodec) {
|
||||
$video->setOptionValue(Video::OPTION_ACODEC, (string) $sd->acodec);
|
||||
}
|
||||
if ($sd->v_codec) {
|
||||
if ($sd->vcodec) {
|
||||
$video->setOptionValue(Video::OPTION_VCODEC, (string) $sd->vcodec);
|
||||
}
|
||||
if ($sd->fps) {
|
||||
|
@@ -20,7 +20,6 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
|
||||
$_GET['oauth_token'] = self::$token;
|
||||
}
|
||||
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
unset($_GET['oauth_token']);
|
||||
@@ -87,6 +86,11 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
|
||||
->with($this->equalTo('GV_client_navigator'))
|
||||
->will($this->returnValue(false));
|
||||
$registryBkp = $this->app["Core"]->getRegistry();
|
||||
|
||||
$fail = null;
|
||||
|
||||
try {
|
||||
|
||||
$this->app["Core"]['Registry'] = $registry;
|
||||
$nativeApp = new \API_OAuth2_Application($appbox, 1);
|
||||
$account = API_OAuth2_Account::create($appbox, self::$user, $nativeApp);
|
||||
@@ -95,13 +99,21 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
|
||||
$this->client->request('GET', '/databoxes/list/?oauth_token=' . $token, array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$content = json_decode($this->client->getResponse()->getContent());
|
||||
$this->assertEquals(403, $content->meta->http_code);
|
||||
$this->app["Core"]['Registry'] = $registryBkp;
|
||||
} catch (\Exception $e) {
|
||||
$fail = $e;
|
||||
}
|
||||
/*
|
||||
|
||||
$this->app["Core"]['Registry'] = $registryBkp;
|
||||
|
||||
if ($fail) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Routes /API/V1/databoxes/DATABOX_ID/xxxxxx
|
||||
*
|
||||
*/
|
||||
|
||||
public function testDataboxRecordRoute()
|
||||
{
|
||||
foreach (static::$databoxe_ids as $databox_id) {
|
||||
@@ -315,7 +327,8 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
|
||||
$this->evaluateBadRequestRoute($route, array('GET'));
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
|
||||
}
|
||||
/*
|
||||
|
||||
/**
|
||||
*
|
||||
* End /API/V1/databoxes/DATABOX_ID/xxxxxx Routes
|
||||
*
|
||||
@@ -324,7 +337,6 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
|
||||
* Routes /API/V1/records/DATABOX_ID/RECORD_ID/xxxxx
|
||||
*
|
||||
*/
|
||||
|
||||
public function testRecordsSearchRoute()
|
||||
{
|
||||
|
||||
@@ -1007,7 +1019,7 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
|
||||
$this->assertObjectHasAttribute('response', $content);
|
||||
$this->assertTrue(is_object($content->meta), 'Le bloc meta est un objet json');
|
||||
$this->assertTrue(is_object($content->response), 'Le bloc reponse est un objet json');
|
||||
$this->assertEquals('1.1', $content->meta->api_version);
|
||||
$this->assertEquals('1.2', $content->meta->api_version);
|
||||
$this->assertNotNull($content->meta->response_time);
|
||||
$this->assertEquals('UTF-8', $content->meta->charset);
|
||||
}
|
||||
|
@@ -93,6 +93,11 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
|
||||
->with($this->equalTo('GV_client_navigator'))
|
||||
->will($this->returnValue(false));
|
||||
$registryBkp = $this->app["Core"]->getRegistry();
|
||||
|
||||
$fail = null;
|
||||
|
||||
try {
|
||||
|
||||
$this->app["Core"]['Registry'] = $registry;
|
||||
$nativeApp = new \API_OAuth2_Application($appbox, 1);
|
||||
$account = API_OAuth2_Account::create($appbox, self::$user, $nativeApp);
|
||||
@@ -101,13 +106,21 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
|
||||
$this->client->request('GET', '/databoxes/list/?oauth_token=' . $token, array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$content = $content = self::$yaml->parse($this->client->getResponse()->getContent());
|
||||
$this->assertEquals(403, $content["meta"]["http_code"]);
|
||||
$this->app["Core"]['Registry'] = $registryBkp;
|
||||
} catch (\Exception $e) {
|
||||
$fail = $e;
|
||||
}
|
||||
/*
|
||||
|
||||
$this->app["Core"]['Registry'] = $registryBkp;
|
||||
|
||||
if ($fail) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Routes /API/V1/databoxes/DATABOX_ID/xxxxxx
|
||||
*
|
||||
*/
|
||||
|
||||
public function testDataboxRecordRoute()
|
||||
{
|
||||
|
||||
@@ -321,7 +334,8 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
|
||||
$this->evaluateBadRequestRoute($route, array('GET'));
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
|
||||
}
|
||||
/*
|
||||
|
||||
/**
|
||||
*
|
||||
* End /API/V1/databoxes/DATABOX_ID/xxxxxx Routes
|
||||
*
|
||||
@@ -330,7 +344,6 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
|
||||
* Routes /API/V1/records/DATABOX_ID/RECORD_ID/xxxxx
|
||||
*
|
||||
*/
|
||||
|
||||
public function testRecordsSearchRoute()
|
||||
{
|
||||
|
||||
@@ -1028,7 +1041,7 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
|
||||
$this->assertArrayHasKey('response', $content);
|
||||
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $content["meta"], 'La response est un array');
|
||||
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $content["response"], 'La response est un objet');
|
||||
$this->assertEquals('1.1', $content["meta"]["api_version"]);
|
||||
$this->assertEquals('1.2', $content["meta"]["api_version"]);
|
||||
$this->assertNotNull($content["meta"]["response_time"]);
|
||||
$this->assertEquals('UTF-8', $content["meta"]["charset"]);
|
||||
}
|
||||
@@ -1040,7 +1053,7 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
|
||||
$this->assertArrayHasKey('response', $content);
|
||||
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $content["meta"], 'La response est un array');
|
||||
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $content["response"], 'La response est un array');
|
||||
$this->assertEquals('1.1', $content["meta"]["api_version"]);
|
||||
$this->assertEquals('1.2', $content["meta"]["api_version"]);
|
||||
$this->assertNotNull($content["meta"]["response_time"]);
|
||||
$this->assertEquals('UTF-8', $content["meta"]["charset"]);
|
||||
}
|
||||
|
@@ -4,7 +4,6 @@ require_once __DIR__ . '/../../PhraseanetPHPUnitAbstract.class.inc';
|
||||
|
||||
class API_OAuth2_TokenTest extends PhraseanetPHPUnitAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* @var API_OAuth2_Application
|
||||
*/
|
||||
@@ -21,13 +20,10 @@ class API_OAuth2_TokenTest extends PhraseanetPHPUnitAbstract
|
||||
$this->application = API_OAuth2_Application::create($appbox, self::$user, 'test app');
|
||||
$account = API_OAuth2_Account::load_with_user($appbox, $this->application, self::$user);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
new API_OAuth2_Token($appbox, $account);
|
||||
$this->fail();
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
@@ -70,6 +66,8 @@ class API_OAuth2_TokenTest extends PhraseanetPHPUnitAbstract
|
||||
public function testGet_expires()
|
||||
{
|
||||
$this->assertInternalType('string', $this->object->get_expires());
|
||||
$this->assertTrue((int) $this->object->get_expires() - time() > 3500);
|
||||
$this->assertTrue((int) $this->object->get_expires() - time() < 3700);
|
||||
}
|
||||
|
||||
public function testSet_expires()
|
||||
@@ -117,11 +115,9 @@ class API_OAuth2_TokenTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
public function testGenerate_token()
|
||||
{
|
||||
for ($i = 0; $i < 100; $i++)
|
||||
{
|
||||
for ($i = 0; $i < 100; $i ++ ) {
|
||||
$this->assertMd5(API_OAuth2_Token::generate_token());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -91,7 +91,7 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGet_version()
|
||||
{
|
||||
$this->assertEquals('1.1', $this->object->get_version());
|
||||
$this->assertEquals('1.2', $this->object->get_version());
|
||||
}
|
||||
|
||||
public function testGet_databoxes()
|
||||
|
@@ -105,8 +105,8 @@ class databox_subdefTest extends PHPUnit_Framework_TestCase
|
||||
<fps>10</fps>
|
||||
<threads>1</threads>
|
||||
<bitrate>192</bitrate>
|
||||
<a_codec>faac</a_codec>
|
||||
<v_codec>libx264</v_codec>
|
||||
<acodec>libfaac</acodec>
|
||||
<vcodec>libx264</vcodec>
|
||||
</subdef>';
|
||||
|
||||
$type = new \Alchemy\Phrasea\Media\Type\Video();
|
||||
|
Reference in New Issue
Block a user