Merge pull request #37 from romainneutron/FixBuild

Fix build
This commit is contained in:
Romain
2012-04-27 03:21:46 -07:00
8 changed files with 170 additions and 147 deletions

View File

@@ -15,7 +15,7 @@ class Audio extends Provider
{ {
const OPTION_BITRATE = 'bitrate'; const OPTION_BITRATE = 'bitrate';
const OPTION_THREADS = 'threads'; const OPTION_THREADS = 'threads';
const OPTION_ACODEC = 'a_codec'; const OPTION_ACODEC = 'acodec';
const OPTION_AUDIOSAMPLERATE = 'audiosamplerate'; const OPTION_AUDIOSAMPLERATE = 'audiosamplerate';
public function __construct() public function __construct()

View File

@@ -304,10 +304,12 @@ class API_OAuth2_Token
(oauth_token, session_id, api_account_id, expires, scope) (oauth_token, session_id, api_account_id, expires, scope)
VALUES (:token, null, :account_id, :expire, :scope)'; VALUES (:token, null, :account_id, :expire, :scope)';
$expires = new \DateTime('+1 hour');
$params = array( $params = array(
':token' => self::generate_token() ':token' => self::generate_token()
, ':account_id' => $account->get_id() , ':account_id' => $account->get_id()
, ':expire' => time() + 3600 , ':expire' => $expires->format(DATE_ISO8601)
, ':scope' => $scope , ':scope' => $scope
); );

View File

@@ -149,10 +149,10 @@ class databox_subdef
if ($sd->size) { if ($sd->size) {
$video->setOptionValue(Video::OPTION_SIZE, (int) $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); $video->setOptionValue(Video::OPTION_ACODEC, (string) $sd->acodec);
} }
if ($sd->v_codec) { if ($sd->vcodec) {
$video->setOptionValue(Video::OPTION_VCODEC, (string) $sd->vcodec); $video->setOptionValue(Video::OPTION_VCODEC, (string) $sd->vcodec);
} }
if ($sd->fps) { if ($sd->fps) {

View File

@@ -20,7 +20,6 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
$_GET['oauth_token'] = self::$token; $_GET['oauth_token'] = self::$token;
} }
public function tearDown() public function tearDown()
{ {
unset($_GET['oauth_token']); unset($_GET['oauth_token']);
@@ -80,13 +79,18 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
{ {
$appbox = appbox::get_instance(\bootstrap::getCore()); $appbox = appbox::get_instance(\bootstrap::getCore());
$registry = $this->getMock('\\registry', array(), array(), '',false); $registry = $this->getMock('\\registry', array(), array(), '', false);
$registry $registry
->expects($this->any()) ->expects($this->any())
->method('get') ->method('get')
->with($this->equalTo('GV_client_navigator')) ->with($this->equalTo('GV_client_navigator'))
->will($this->returnValue(false)); ->will($this->returnValue(false));
$registryBkp = $this->app["Core"]->getRegistry(); $registryBkp = $this->app["Core"]->getRegistry();
$fail = null;
try {
$this->app["Core"]['Registry'] = $registry; $this->app["Core"]['Registry'] = $registry;
$nativeApp = new \API_OAuth2_Application($appbox, 1); $nativeApp = new \API_OAuth2_Application($appbox, 1);
$account = API_OAuth2_Account::create($appbox, self::$user, $nativeApp); $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')); $this->client->request('GET', '/databoxes/list/?oauth_token=' . $token, array(), array(), array('HTTP_Accept' => 'application/json'));
$content = json_decode($this->client->getResponse()->getContent()); $content = json_decode($this->client->getResponse()->getContent());
$this->assertEquals(403, $content->meta->http_code); $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 * Routes /API/V1/databoxes/DATABOX_ID/xxxxxx
* *
*/ */
public function testDataboxRecordRoute() public function testDataboxRecordRoute()
{ {
foreach (static::$databoxe_ids as $databox_id) { foreach (static::$databoxe_ids as $databox_id) {
@@ -315,7 +327,8 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
$this->evaluateBadRequestRoute($route, array('GET')); $this->evaluateBadRequestRoute($route, array('GET'));
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE')); $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
} }
/*
/**
* *
* End /API/V1/databoxes/DATABOX_ID/xxxxxx Routes * 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 * Routes /API/V1/records/DATABOX_ID/RECORD_ID/xxxxx
* *
*/ */
public function testRecordsSearchRoute() public function testRecordsSearchRoute()
{ {
@@ -1007,7 +1019,7 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
$this->assertObjectHasAttribute('response', $content); $this->assertObjectHasAttribute('response', $content);
$this->assertTrue(is_object($content->meta), 'Le bloc meta est un objet json'); $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->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->assertNotNull($content->meta->response_time);
$this->assertEquals('UTF-8', $content->meta->charset); $this->assertEquals('UTF-8', $content->meta->charset);
} }

View File

@@ -93,6 +93,11 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
->with($this->equalTo('GV_client_navigator')) ->with($this->equalTo('GV_client_navigator'))
->will($this->returnValue(false)); ->will($this->returnValue(false));
$registryBkp = $this->app["Core"]->getRegistry(); $registryBkp = $this->app["Core"]->getRegistry();
$fail = null;
try {
$this->app["Core"]['Registry'] = $registry; $this->app["Core"]['Registry'] = $registry;
$nativeApp = new \API_OAuth2_Application($appbox, 1); $nativeApp = new \API_OAuth2_Application($appbox, 1);
$account = API_OAuth2_Account::create($appbox, self::$user, $nativeApp); $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')); $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()); $content = $content = self::$yaml->parse($this->client->getResponse()->getContent());
$this->assertEquals(403, $content["meta"]["http_code"]); $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 * Routes /API/V1/databoxes/DATABOX_ID/xxxxxx
* *
*/ */
public function testDataboxRecordRoute() public function testDataboxRecordRoute()
{ {
@@ -321,7 +334,8 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
$this->evaluateBadRequestRoute($route, array('GET')); $this->evaluateBadRequestRoute($route, array('GET'));
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE')); $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
} }
/*
/**
* *
* End /API/V1/databoxes/DATABOX_ID/xxxxxx Routes * 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 * Routes /API/V1/records/DATABOX_ID/RECORD_ID/xxxxx
* *
*/ */
public function testRecordsSearchRoute() public function testRecordsSearchRoute()
{ {
@@ -1028,7 +1041,7 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
$this->assertArrayHasKey('response', $content); $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["meta"], 'La response est un array');
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $content["response"], 'La response est un objet'); $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->assertNotNull($content["meta"]["response_time"]);
$this->assertEquals('UTF-8', $content["meta"]["charset"]); $this->assertEquals('UTF-8', $content["meta"]["charset"]);
} }
@@ -1040,7 +1053,7 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
$this->assertArrayHasKey('response', $content); $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["meta"], 'La response est un array');
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $content["response"], '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->assertNotNull($content["meta"]["response_time"]);
$this->assertEquals('UTF-8', $content["meta"]["charset"]); $this->assertEquals('UTF-8', $content["meta"]["charset"]);
} }

View File

@@ -4,7 +4,6 @@ require_once __DIR__ . '/../../PhraseanetPHPUnitAbstract.class.inc';
class API_OAuth2_TokenTest extends PhraseanetPHPUnitAbstract class API_OAuth2_TokenTest extends PhraseanetPHPUnitAbstract
{ {
/** /**
* @var API_OAuth2_Application * @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'); $this->application = API_OAuth2_Application::create($appbox, self::$user, 'test app');
$account = API_OAuth2_Account::load_with_user($appbox, $this->application, self::$user); $account = API_OAuth2_Account::load_with_user($appbox, $this->application, self::$user);
try try {
{
new API_OAuth2_Token($appbox, $account); new API_OAuth2_Token($appbox, $account);
$this->fail(); $this->fail();
} } catch (Exception $e) {
catch (Exception $e)
{
} }
@@ -70,6 +66,8 @@ class API_OAuth2_TokenTest extends PhraseanetPHPUnitAbstract
public function testGet_expires() public function testGet_expires()
{ {
$this->assertInternalType('string', $this->object->get_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() public function testSet_expires()
@@ -117,11 +115,9 @@ class API_OAuth2_TokenTest extends PhraseanetPHPUnitAbstract
public function testGenerate_token() public function testGenerate_token()
{ {
for ($i = 0; $i < 100; $i++) for ($i = 0; $i < 100; $i ++ ) {
{
$this->assertMd5(API_OAuth2_Token::generate_token()); $this->assertMd5(API_OAuth2_Token::generate_token());
} }
} }
} }

View File

@@ -91,7 +91,7 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testGet_version() public function testGet_version()
{ {
$this->assertEquals('1.1', $this->object->get_version()); $this->assertEquals('1.2', $this->object->get_version());
} }
public function testGet_databoxes() public function testGet_databoxes()

View File

@@ -105,8 +105,8 @@ class databox_subdefTest extends PHPUnit_Framework_TestCase
<fps>10</fps> <fps>10</fps>
<threads>1</threads> <threads>1</threads>
<bitrate>192</bitrate> <bitrate>192</bitrate>
<a_codec>faac</a_codec> <acodec>libfaac</acodec>
<v_codec>libx264</v_codec> <vcodec>libx264</vcodec>
</subdef>'; </subdef>';
$type = new \Alchemy\Phrasea\Media\Type\Video(); $type = new \Alchemy\Phrasea\Media\Type\Video();