mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 12:03:14 +00:00
Refactor Appbox
This commit is contained in:
@@ -27,7 +27,7 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
self::$application = API_OAuth2_Application::create($appbox, self::$user, 'test API v1');
|
||||
$account = API_OAuth2_Account::load_with_user($appbox, self::$application, self::$user);
|
||||
self::$token = $account->get_token()->get_value();
|
||||
@@ -803,7 +803,7 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
|
||||
$this->evaluateMetaJson200($content);
|
||||
|
||||
$this->assertEquals(1, count((array) $content->response));
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$this->assertObjectHasAttribute("basket", $content->response);
|
||||
|
||||
foreach ($content->response->basket as $basket)
|
||||
@@ -815,7 +815,7 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
|
||||
|
||||
public function testBasketContent()
|
||||
{
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$usr_id = $appbox->get_session()->get_usr_id();
|
||||
|
||||
$basket = $this->insertOneBasket();
|
||||
|
@@ -34,7 +34,7 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
self::$yaml = new Symfony\Component\Yaml\Parser();
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
self::$application = API_OAuth2_Application::create($appbox, self::$user, 'test API v1');
|
||||
$account = API_OAuth2_Account::load_with_user($appbox, self::$application, self::$user);
|
||||
self::$token = $account->get_token()->get_value();
|
||||
@@ -825,7 +825,7 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
|
||||
$this->evaluateMetaYaml200($content);
|
||||
|
||||
$this->assertEquals(1, count((array) $content["response"]));
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$this->assertArrayHasKey("basket", $content["response"]);
|
||||
|
||||
foreach ($content["response"]["basket"] as $basket)
|
||||
|
@@ -23,7 +23,7 @@ class ApplicationLightboxTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
parent::setUp();
|
||||
$this->client = $this->createClient();
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$this->feed = Feed_Adapter::create($appbox, self::$user, "salut", 'coucou');
|
||||
$publisher = array_shift($this->feed->get_publishers());
|
||||
$this->entry = Feed_Entry_Adapter::create($appbox, $this->feed, $publisher, 'title', "sub Titkle", " jean pierre", "jp@test.com");
|
||||
|
@@ -42,7 +42,7 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
|
||||
, 'website' => 'http://website.com/'
|
||||
);
|
||||
|
||||
self::$appli = API_OAuth2_Application::create(appbox::get_instance(), self::$user, 'test');
|
||||
self::$appli = API_OAuth2_Application::create(appbox::get_instance(\bootstrap::getCore()), self::$user, 'test');
|
||||
self::$appli->set_description('une description')
|
||||
->set_redirect_uri('http://callback.com/callback/')
|
||||
->set_website('http://website.com/')
|
||||
@@ -55,7 +55,7 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
|
||||
{
|
||||
parent::tearDownAfterClass();
|
||||
if (self::$appli !== false)
|
||||
self::deleteInsertedRow(appbox::get_instance(), self::$appli);
|
||||
self::deleteInsertedRow(appbox::get_instance(\bootstrap::getCore()), self::$appli);
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
@@ -96,7 +96,7 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
|
||||
{
|
||||
$sql = "SELECT * FROM api_applications WHERE application_id = :app_id";
|
||||
$t = array(":app_id" => $rowId);
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$conn = $appbox->get_connection();
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute($t);
|
||||
@@ -109,13 +109,13 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
|
||||
{
|
||||
$sql = "SELECT api_account_id FROM api_accounts WHERE application_id = :app_id AND usr_id = :usr_id";
|
||||
$t = array(":app_id" => self::$appli->get_id(), ":usr_id" => self::$user->get_id());
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$conn = $appbox->get_connection();
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute($t);
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
return new API_OAuth2_Account(appbox::get_instance(), $row["api_account_id"]);
|
||||
return new API_OAuth2_Account(appbox::get_instance(\bootstrap::getCore()), $row["api_account_id"]);
|
||||
}
|
||||
|
||||
public function setQueryParameters($parameter, $value)
|
||||
@@ -137,7 +137,7 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
|
||||
public function testAuthorizeRedirect()
|
||||
{
|
||||
//session off
|
||||
$apps = API_OAuth2_Application::load_authorized_app_by_user(appbox::get_instance(), self::$user);
|
||||
$apps = API_OAuth2_Application::load_authorized_app_by_user(appbox::get_instance(\bootstrap::getCore()), self::$user);
|
||||
foreach($apps as $app)
|
||||
{
|
||||
if($app->get_client_id() == self::$appli->get_client_id())
|
||||
|
@@ -81,7 +81,7 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
function testDatafilesRouteNotAuthenticated()
|
||||
{
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox->get_session()->logout();
|
||||
$crawler = $this->client->request('GET', '/datafiles/' . self::$record_1->get_sbas_id() . '/' . self::$record_1->get_record_id() . '/preview/');
|
||||
$response = $this->client->getResponse();
|
||||
@@ -94,14 +94,14 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
function testPermalinkAuthenticated()
|
||||
{
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$this->assertTrue($appbox->get_session()->is_authenticated());
|
||||
$this->get_a_permalink();
|
||||
}
|
||||
|
||||
function testPermalinkNotAuthenticated()
|
||||
{
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox->get_session()->logout();
|
||||
$this->assertFalse($appbox->get_session()->is_authenticated());
|
||||
$this->get_a_permalink();
|
||||
|
@@ -53,7 +53,7 @@ class CoreTest extends PhraseanetPHPUnitAbstract
|
||||
public function testIsAuthenticathed()
|
||||
{
|
||||
$this->assertFalse(self::$core->isAuthenticated());
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$session->authenticate($auth);
|
||||
@@ -63,7 +63,7 @@ class CoreTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
public function testGetAuthenticathed()
|
||||
{
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$session->authenticate($auth);
|
||||
|
Reference in New Issue
Block a user