コード例 #1
0
 /**
  * @covers \Alchemy\Phrasea\Controller\Root\Developers::newApp
  */
 public function testPostNewApp()
 {
     $apps = \API_OAuth2_Application::load_dev_app_by_user(self::$DI['app'], self::$DI['user']);
     $nbApp = count($apps);
     self::$DI['client']->request('POST', '/developers/application/', ['type' => \API_OAuth2_Application::WEB_TYPE, 'name' => 'hello', 'description' => 'okok', 'website' => 'my.website.com', 'callback' => 'my.callback.com', 'scheme-website' => 'http://', 'scheme-callback' => 'http://']);
     $apps = \API_OAuth2_Application::load_dev_app_by_user(self::$DI['app'], self::$DI['user']);
     $this->assertTrue(self::$DI['client']->getResponse()->isRedirect());
     $this->assertGreaterThan($nbApp, count($apps));
 }
コード例 #2
0
 public function testLoad_dev_app_by_user()
 {
     $apps = API_OAuth2_Application::load_dev_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();
     }
 }
コード例 #3
0
 /**
  * List of apps created by the user
  *
  * @param  Application $app     A Silex application where the controller is mounted on
  * @param  Request     $request The current request
  * @return Response
  */
 public function listApps(Application $app, Request $request)
 {
     return $app['twig']->render('developers/applications.html.twig', ["applications" => \API_OAuth2_Application::load_dev_app_by_user($app, $app['authentication']->getUser())]);
 }