public function testLoad_app_by_user()
 {
     $apps = API_OAuth2_Application::load_app_by_user(self::$DI['app'], self::$DI['user']);
     $this->assertTrue(is_array($apps));
     $this->assertTrue(count($apps) > 0);
     $found = false;
     foreach ($apps as $app) {
         if ($app->get_id() === self::$DI['oauth2-app-user']->get_id()) {
             $found = true;
         }
         $this->assertInstanceOf('API_OAuth2_Application', $app);
     }
     if (!$found) {
         $this->fail();
     }
 }
Exemple #2
0
 /**
  * Display authorized applications that can access user informations
  *
  * @param  Application $app     A Silex application where the controller is mounted on
  * @param  Request     $request The current request
  * @return Response
  */
 public function accountAuthorizedApps(Application $app, Request $request)
 {
     return $app['twig']->render('account/authorized_apps.html.twig', ["applications" => \API_OAuth2_Application::load_app_by_user($app, $app['authentication']->getUser())]);
 }