public function renderConfiguration($owner)
 {
     $controller = new GooglePlusPluginConfigurationController($owner, 'googleplus');
     return $controller->go();
 }
 public function testGetUserProfileWith403Error()
 {
     $builders = $this->buildPluginOptions();
     $config = Config::getInstance();
     $config->setValue('site_root_path', '/');
     $plugin_options_dao = DAOFactory::getDAO("PluginOptionDAO");
     PluginOptionMySQLDAO::$cached_options = array();
     $builders[] = FixtureBuilder::build('owners', array('email' => '*****@*****.**', 'user_activated' => 1));
     $this->simulateLogin('*****@*****.**');
     $owner_dao = DAOFactory::getDAO('OwnerDAO');
     $owner = $owner_dao->getByEmail(Session::getLoggedInUser());
     $controller = new GooglePlusPluginConfigurationController($owner);
     $_GET['code'] = 'test-google-provided-code-user-profile-403-error';
     $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! Looks like Google+ API access isn\'t turned on. ' . '<a href="http://code.google.com/apis/console#access">In the Google APIs console</a>, in Services, flip the ' . 'Google+ API Status switch to \'On\' and try again.');
     $this->debug(Utils::varDumpToString($msgs));
 }
 public function testConfigOptionsIsAdmin()
 {
     $builders = self::buildInstanceData();
     // build some options data
     $options_array = $this->buildPluginOptions();
     $this->simulateLogin('*****@*****.**', true);
     $owner_dao = DAOFactory::getDAO('OwnerDAO');
     $owner = $owner_dao->getByEmail(Session::getLoggedInUser());
     $controller = new GooglePlusPluginConfigurationController($owner);
     $output = $controller->go();
     $this->debug($output);
     // we have a text form element with proper data
     $this->assertPattern('/Pause crawling/', $output);
     $this->assertPattern('/Save Settings/', $output);
     // should have submit option
     $this->assertPattern('/plugin_options_error_google_plus_client_secret/', $output);
     // secret option
     $this->assertPattern('/plugin_options_error_message_google_plus_client_id/', $output);
     // advanced option
     $this->assertPattern('/var is_admin = true/', $output);
     // is a js admin
     $this->assertPattern('/var required_values_set = true/', $output);
     // is configured
     //app not configured
     $sql = "select id from " . $this->table_prefix . "plugins where folder_name = 'googleplus'";
     $stmt = PluginMySQLDAO::$PDO->query($sql);
     $data = $stmt->fetch(PDO::FETCH_ASSOC);
     $prefix = Config::getInstance()->getValue('table_prefix');
     $namespace = OptionDAO::PLUGIN_OPTIONS . '-' . $data['id'];
     OwnerMySQLDAO::$PDO->query("delete from " . $prefix . "options where namespace = '{$namespace}'");
     $controller = new GooglePlusPluginConfigurationController($owner);
     $output = $controller->go();
     $this->assertPattern('/var required_values_set = false/', $output);
     // is not configured
 }