예제 #1
0
 public function renderConfiguration($owner)
 {
     // Create a new controller for the plugin
     $controller = new FoursquarePluginConfigurationController($owner, 'foursquare');
     return $controller->go();
 }
 public function testGetOAuthTokensWithError()
 {
     // Build the plugin options
     $builders = $this->buildPluginOptions();
     // Get an instance
     $config = Config::getInstance();
     // Set the root path
     $config->setValue('site_root_path', '/');
     // Get a plugin option DAO
     $plugin_options_dao = DAOFactory::getDAO("PluginOptionDAO");
     //
     PluginOptionMySQLDAO::$cached_options = array();
     // Build a owner
     $builders[] = FixtureBuilder::build('owners', array('email' => '*****@*****.**', 'user_activated' => 1));
     // Log the owner in
     $this->simulateLogin('*****@*****.**');
     // Get a owner DAO
     $owner_dao = DAOFactory::getDAO('OwnerDAO');
     // Get the logged in owners email address
     $owner = $owner_dao->getByEmail(Session::getLoggedInUser());
     // Create a new controller for this user
     $controller = new FoursquarePluginConfigurationController($owner);
     // Set the return code from foursquare to anything not valid
     $_GET['code'] = 'error5dn';
     // Check the user is told theres a problem
     $results = $controller->go();
     $v_mgr = $controller->getViewManager();
     $this->assertEqual($v_mgr->getTemplateDataItem('success_msg'), '');
     $msgs = $v_mgr->getTemplateDataItem('error_msgs');
     $this->assertEqual($msgs['authorization'], 'Oops! Something went wrong while obtaining OAuth tokens.' . ' foursquare says "foursquare_error_text." Please double-check your settings and try again.');
 }