Exemplo n.º 1
0
 public function setUp()
 {
     parent::setUp();
     self::$DI['app'] = self::$DI->share(function ($DI) {
         return $this->loadApp('/lib/Alchemy/Phrasea/Application/Api.php');
     });
 }
Exemplo n.º 2
0
 public function setUp()
 {
     parent::setUp();
     self::$DI['app'] = self::$DI->share(function ($DI) {
         return $this->loadApp('lib/Alchemy/Phrasea/Application/Api.php');
     });
     if (!self::$apiInitialized) {
         self::$account = \API_OAuth2_Account::load_with_user(self::$DI['app'], self::$DI['oauth2-app-user_notAdmin'], self::$DI['user_notAdmin']);
         self::$account->set_revoked(false);
         self::$token = self::$account->get_token()->get_value();
         self::$adminAccount = \API_OAuth2_Account::load_with_user(self::$DI['app'], self::$DI['oauth2-app-user'], self::$DI['user']);
         self::$adminAccount->set_revoked(false);
         self::$adminToken = self::$adminAccount->get_token()->get_value();
         self::$apiInitialized = true;
     }
 }
Exemplo n.º 3
0
 public function setUp()
 {
     parent::setUp();
     if (null === $this->adminAccessToken) {
         $tokens = self::$DI['app']['repo.api-oauth-tokens']->findOauthTokens(self::$DI['oauth2-app-acc-user']);
         if (count($tokens) === 0) {
             $this->fail(sprintf('No access token generated between user %s & application %s', self::$DI['oauth2-app-acc-user']->getUser()->getLogin(), self::$DI['oauth2-app-acc-user']->getApplication()->getName()));
         }
         $this->adminAccessToken = current($tokens);
     }
     if (null === $this->userAccessToken) {
         $tokens = self::$DI['app']['repo.api-oauth-tokens']->findOauthTokens(self::$DI['oauth2-app-acc-user-not-admin']);
         if (count($tokens) === 0) {
             $this->fail(sprintf('No access token generated between user %s & application %s', self::$DI['oauth2-app-acc-user-not-admin']->getUser()->getLogin(), self::$DI['oauth2-app-acc-user-not-admin']->getApplication()->getName()));
         }
         $this->userAccessToken = current($tokens);
     }
 }
Exemplo n.º 4
0
 public function setUp()
 {
     parent::setUp();
     $this->auth = $this->getMock("Bridge_Api_Auth_Interface");
     $this->bridgeApi = $this->getMock('Bridge_Api_Abstract', ["is_configured", "initialize_transport", "set_auth_params", "set_transport_authentication_params"], [self::$DI['app']['url_generator'], self::$DI['app']['conf'], $this->auth, self::$DI['app']['translator']]);
     if (!self::$api) {
         $application = $this->getApplication();
         try {
             self::$api = Bridge_Api::get_by_api_name($application, 'apitest');
         } catch (Bridge_Exception_ApiNotFound $e) {
             self::$api = Bridge_Api::create($application, 'apitest');
         }
         try {
             self::$account = Bridge_Account::load_account_from_distant_id($application, self::$api, self::$DI['user'], 'kirikoo');
         } catch (Bridge_Exception_AccountNotFound $e) {
             self::$account = Bridge_Account::create($application, self::$api, self::$DI['user'], 'kirikoo', 'coucou');
         }
     }
 }
Exemplo n.º 5
0
 public function setUp()
 {
     parent::setUp();
     $this->app = $this->loadApp('lib/Alchemy/Phrasea/Application/Root.php');
     $this->app['phraseanet.configuration-tester'] = $this->getMockBuilder('Alchemy\\Phrasea\\Setup\\ConfigurationTester')->disableOriginalConstructor()->getMock();
 }
Exemplo n.º 6
0
 public function setUp()
 {
     parent::setUp();
     $this->auth = $this->getMock("Bridge_Api_Auth_Interface");
     $this->bridgeApi = $this->getMock('Bridge_Api_Abstract', ["is_configured", "initialize_transport", "set_auth_params", "set_transport_authentication_params"], [self::$DI['app']['url_generator'], self::$DI['app']['conf'], $this->auth, self::$DI['app']['translator']]);
 }