diff --git a/lib/Alchemy/Phrasea/Media/Subdef/Audio.php b/lib/Alchemy/Phrasea/Media/Subdef/Audio.php
index d8e863e502..aa5c4038ab 100644
--- a/lib/Alchemy/Phrasea/Media/Subdef/Audio.php
+++ b/lib/Alchemy/Phrasea/Media/Subdef/Audio.php
@@ -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()
diff --git a/lib/classes/API/OAuth2/Token.class.php b/lib/classes/API/OAuth2/Token.class.php
index cdf35cf5cb..2376f42c82 100644
--- a/lib/classes/API/OAuth2/Token.class.php
+++ b/lib/classes/API/OAuth2/Token.class.php
@@ -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
);
diff --git a/lib/classes/databox/subdef.class.php b/lib/classes/databox/subdef.class.php
index ea34bc1a0f..c70acdf3cd 100644
--- a/lib/classes/databox/subdef.class.php
+++ b/lib/classes/databox/subdef.class.php
@@ -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) {
diff --git a/tests/Alchemy/Phrasea/Application/ApiJsonTest.php b/tests/Alchemy/Phrasea/Application/ApiJsonTest.php
index d686ab88f3..b8ac926dac 100644
--- a/tests/Alchemy/Phrasea/Application/ApiJsonTest.php
+++ b/tests/Alchemy/Phrasea/Application/ApiJsonTest.php
@@ -20,12 +20,11 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
$_GET['oauth_token'] = self::$token;
}
-
public function tearDown()
{
unset($_GET['oauth_token']);
}
-
+
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
@@ -80,28 +79,41 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
{
$appbox = appbox::get_instance(\bootstrap::getCore());
- $registry = $this->getMock('\\registry', array(), array(), '',false);
+ $registry = $this->getMock('\\registry', array(), array(), '', false);
$registry
->expects($this->any())
->method('get')
->with($this->equalTo('GV_client_navigator'))
->will($this->returnValue(false));
$registryBkp = $this->app["Core"]->getRegistry();
- $this->app["Core"]['Registry'] = $registry;
- $nativeApp = new \API_OAuth2_Application($appbox, 1);
- $account = API_OAuth2_Account::create($appbox, self::$user, $nativeApp);
- $token = $account->get_token()->get_value();
- $_GET['oauth_token'] = $token;
- $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);
+
+ $fail = null;
+
+ try {
+
+ $this->app["Core"]['Registry'] = $registry;
+ $nativeApp = new \API_OAuth2_Application($appbox, 1);
+ $account = API_OAuth2_Account::create($appbox, self::$user, $nativeApp);
+ $token = $account->get_token()->get_value();
+ $_GET['oauth_token'] = $token;
+ $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);
+ } 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);
}
diff --git a/tests/Alchemy/Phrasea/Application/ApiYamlTest.php b/tests/Alchemy/Phrasea/Application/ApiYamlTest.php
index c7b74fbb5b..9fcaa0d2e5 100644
--- a/tests/Alchemy/Phrasea/Application/ApiYamlTest.php
+++ b/tests/Alchemy/Phrasea/Application/ApiYamlTest.php
@@ -93,21 +93,34 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
->with($this->equalTo('GV_client_navigator'))
->will($this->returnValue(false));
$registryBkp = $this->app["Core"]->getRegistry();
- $this->app["Core"]['Registry'] = $registry;
- $nativeApp = new \API_OAuth2_Application($appbox, 1);
- $account = API_OAuth2_Account::create($appbox, self::$user, $nativeApp);
- $token = $account->get_token()->get_value();
- $_GET['oauth_token'] = $token;
- $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"]);
+
+ $fail = null;
+
+ try {
+
+ $this->app["Core"]['Registry'] = $registry;
+ $nativeApp = new \API_OAuth2_Application($appbox, 1);
+ $account = API_OAuth2_Account::create($appbox, self::$user, $nativeApp);
+ $token = $account->get_token()->get_value();
+ $_GET['oauth_token'] = $token;
+ $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"]);
+ } 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"]);
}
diff --git a/tests/api/oauthv2/api_oauthv2_TokenTest.php b/tests/api/oauthv2/api_oauthv2_TokenTest.php
index 24e6691306..3741611640 100644
--- a/tests/api/oauthv2/api_oauthv2_TokenTest.php
+++ b/tests/api/oauthv2/api_oauthv2_TokenTest.php
@@ -4,124 +4,120 @@ require_once __DIR__ . '/../../PhraseanetPHPUnitAbstract.class.inc';
class API_OAuth2_TokenTest extends PhraseanetPHPUnitAbstract
{
+ /**
+ * @var API_OAuth2_Application
+ */
+ protected $application;
- /**
- * @var API_OAuth2_Application
- */
- protected $application;
+ /**
+ * @var API_OAuth2_Token
+ */
+ protected $object;
- /**
- * @var API_OAuth2_Token
- */
- protected $object;
-
- public function setUp()
- {
- $appbox = appbox::get_instance(\bootstrap::getCore());
- $this->application = API_OAuth2_Application::create($appbox, self::$user, 'test app');
- $account = API_OAuth2_Account::load_with_user($appbox, $this->application, self::$user);
-
- try
- {
- new API_OAuth2_Token($appbox, $account);
- $this->fail();
- }
- catch (Exception $e)
+ public function setUp()
{
+ $appbox = appbox::get_instance(\bootstrap::getCore());
+ $this->application = API_OAuth2_Application::create($appbox, self::$user, 'test app');
+ $account = API_OAuth2_Account::load_with_user($appbox, $this->application, self::$user);
+ try {
+ new API_OAuth2_Token($appbox, $account);
+ $this->fail();
+ } catch (Exception $e) {
+
+ }
+
+ $this->object = API_OAuth2_Token::create($appbox, $account);
}
- $this->object = API_OAuth2_Token::create($appbox, $account);
- }
-
- public function tearDown()
- {
- $this->application->delete();
- }
-
- protected function assertmd5($md5)
- {
- $this->assertTrue((count(preg_match('/[a-z0-9]{32}/', $md5)) === 1));
- }
-
- public function testGet_value()
- {
- $this->assertmd5($this->object->get_value());
- }
-
- public function testSet_value()
- {
- $value = md5('prout');
- $this->object->set_value($value);
- $this->assertEquals($value, $this->object->get_value());
- }
-
- public function testGet_session_id()
- {
- $this->assertNull($this->object->get_session_id());
- }
-
- public function testSet_session_id()
- {
- $this->object->set_session_id(458);
- $this->assertEquals(458, $this->object->get_session_id());
- }
-
- public function testGet_expires()
- {
- $this->assertInternalType('string', $this->object->get_expires());
- }
-
- public function testSet_expires()
- {
- $date = time() + 7200;
- $this->object->set_expires($date);
- $this->assertEquals($date, $this->object->get_expires());
- }
-
- public function testGet_scope()
- {
- $this->assertNull($this->object->get_scope());
- }
-
- public function testset_scope()
- {
- $this->assertNull($this->object->get_scope());
- $scope = "prout";
- $this->object->set_scope($scope);
- $this->assertEquals($scope, $this->object->get_scope());
- }
-
- public function testGet_account()
- {
- $this->assertInstanceOf('API_OAuth2_Account', $this->object->get_account());
- }
-
- public function testRenew()
- {
- $first = $this->object->get_value();
- $this->assertMd5($first);
- $this->object->renew();
- $second = $this->object->get_value();
- $this->assertMd5($second);
- $this->assertNotEquals($second, $first);
- }
-
- public function testLoad_by_oauth_token()
- {
- $token = $this->object->get_value();
- $loaded = API_OAuth2_Token::load_by_oauth_token(appbox::get_instance(\bootstrap::getCore()), $token);
- $this->assertInstanceOf('API_OAuth2_Token', $loaded);
- $this->assertEquals($this->object, $loaded);
- }
-
- public function testGenerate_token()
- {
- for ($i = 0; $i < 100; $i++)
+ public function tearDown()
{
- $this->assertMd5(API_OAuth2_Token::generate_token());
+ $this->application->delete();
}
- }
+ protected function assertmd5($md5)
+ {
+ $this->assertTrue((count(preg_match('/[a-z0-9]{32}/', $md5)) === 1));
+ }
+
+ public function testGet_value()
+ {
+ $this->assertmd5($this->object->get_value());
+ }
+
+ public function testSet_value()
+ {
+ $value = md5('prout');
+ $this->object->set_value($value);
+ $this->assertEquals($value, $this->object->get_value());
+ }
+
+ public function testGet_session_id()
+ {
+ $this->assertNull($this->object->get_session_id());
+ }
+
+ public function testSet_session_id()
+ {
+ $this->object->set_session_id(458);
+ $this->assertEquals(458, $this->object->get_session_id());
+ }
+
+ 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()
+ {
+ $date = time() + 7200;
+ $this->object->set_expires($date);
+ $this->assertEquals($date, $this->object->get_expires());
+ }
+
+ public function testGet_scope()
+ {
+ $this->assertNull($this->object->get_scope());
+ }
+
+ public function testset_scope()
+ {
+ $this->assertNull($this->object->get_scope());
+ $scope = "prout";
+ $this->object->set_scope($scope);
+ $this->assertEquals($scope, $this->object->get_scope());
+ }
+
+ public function testGet_account()
+ {
+ $this->assertInstanceOf('API_OAuth2_Account', $this->object->get_account());
+ }
+
+ public function testRenew()
+ {
+ $first = $this->object->get_value();
+ $this->assertMd5($first);
+ $this->object->renew();
+ $second = $this->object->get_value();
+ $this->assertMd5($second);
+ $this->assertNotEquals($second, $first);
+ }
+
+ public function testLoad_by_oauth_token()
+ {
+ $token = $this->object->get_value();
+ $loaded = API_OAuth2_Token::load_by_oauth_token(appbox::get_instance(\bootstrap::getCore()), $token);
+ $this->assertInstanceOf('API_OAuth2_Token', $loaded);
+ $this->assertEquals($this->object, $loaded);
+ }
+
+ public function testGenerate_token()
+ {
+ for ($i = 0; $i < 100; $i ++ ) {
+ $this->assertMd5(API_OAuth2_Token::generate_token());
+ }
+ }
}
diff --git a/tests/api/v1/api_v1_adapterTest.php b/tests/api/v1/api_v1_adapterTest.php
index 4bd98c6ae0..066ff2a6d4 100644
--- a/tests/api/v1/api_v1_adapterTest.php
+++ b/tests/api/v1/api_v1_adapterTest.php
@@ -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()
diff --git a/tests/databox/databox_subdefTest.php b/tests/databox/databox_subdefTest.php
index dce15a835c..23794ba5ad 100644
--- a/tests/databox/databox_subdefTest.php
+++ b/tests/databox/databox_subdefTest.php
@@ -105,8 +105,8 @@ class databox_subdefTest extends PHPUnit_Framework_TestCase
10
1
192
- faac
- libx264
+ libfaac
+ libx264
';
$type = new \Alchemy\Phrasea\Media\Type\Video();