Skip to content

Commit

Permalink
Restore Web site URL and suggested Twitter app name in Facebook and T…
Browse files Browse the repository at this point in the history
…witter plugin settings pages
  • Loading branch information
ginatrapani committed Mar 21, 2012
1 parent 1708fd2 commit a15b3c5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Expand Up @@ -71,6 +71,8 @@ public function authControl() {
'default_value' => '20', 'advanced'=>true, 'size' => 3);
$this->addPluginOption(self::FORM_TEXT_ELEMENT, $max_crawl_time);

$this->addToView('thinkup_site_url', Utils::getApplicationURL());

$facebook_plugin = new FacebookPlugin();
if ($facebook_plugin->isConfigured()) {
$this->setUpFacebookInteractions($facebook_plugin->getOptionsHash());
Expand Down Expand Up @@ -157,7 +159,6 @@ protected function setUpFacebookInteractions($options) {
}

$this->addToView('owner_instances', $owner_instances);
$this->addToView('thinkup_site_url', Utils::getApplicationURL());
}

/**
Expand Down
Expand Up @@ -111,6 +111,9 @@ public function testConfigNotSet() {
$info = $v_mgr->getTemplateDataItem('info_msgs');
$this->assertEqual($info['setup'], 'Please complete plugin setup to start using it.');
$this->debug(Utils::varDumpToString($info));
//assert configuration URL is showing
$site_url = $v_mgr->getTemplateDataItem('thinkup_site_url');
$this->assertEqual($site_url, Utils::getApplicationURL());
}

public function testOutputNoParams() {
Expand Down Expand Up @@ -552,7 +555,7 @@ public function testForDeleteCSRFToken() {

// add mock page data to view
$owner_instance_pages = array(
'123456' =>
'123456' =>
array('id' => '123456',
'network_username' => 'test_username',
'network' => 'facebook', ));
Expand Down
Expand Up @@ -99,6 +99,9 @@ public function authControl() {
}
}

$this->addToView('twitter_app_name', "ThinkUp ". $_SERVER['SERVER_NAME']);
$this->addToView('thinkup_site_url', Utils::getApplicationURL());

$plugin = new TwitterPlugin();
if ($plugin->isConfigured()) {
$to = new TwitterOAuth($oauth_consumer_key, $oauth_consumer_secret);
Expand All @@ -117,8 +120,6 @@ public function authControl() {

$this->addToView('owner_instances', $owner_instances);
$this->addToView('oauthorize_link', $oauthorize_link);
$this->addToView('twitter_app_name', "ThinkUp ". $_SERVER['SERVER_NAME']);
$this->addToView('thinkup_site_url', Utils::getApplicationURL());
$this->addToView('is_configured', true);
} else {
//set error message here
Expand Down
Expand Up @@ -68,7 +68,7 @@ protected function buildData(){
while ($counter < 40) {
$pseudo_minute = str_pad($counter, 2, "0", STR_PAD_LEFT);
$builders[] = FixtureBuilder::build('posts', array('post_id'=>$counter, 'author_user_id'=>13,
'author_username'=>'ev', 'author_fullname'=>'Ev Williams', 'author_avatar'=>'avatar.jpg',
'author_username'=>'ev', 'author_fullname'=>'Ev Williams', 'author_avatar'=>'avatar.jpg',
'post_text'=>'This is post'.$counter, 'source'=>'web', 'pub_date'=>'2006-01-01 00:'.$pseudo_minute.':00',
'reply_count_cache'=>rand(0, 4), 'retweet_count_cache'=>5));
$counter++;
Expand Down Expand Up @@ -225,6 +225,14 @@ public function testConfigOptionsMissingRequiredValues() {

//not SSL by default
$this->assertNoPattern('/https:\/\/mytestthinkup/', $output);

//assert site URL is set so user can configure the app
$v_mgr = $controller->getViewManager();

$site_url = $v_mgr->getTemplateDataItem('thinkup_site_url');
$this->assertEqual($site_url, Utils::getApplicationURL());
$twitter_app_name = $v_mgr->getTemplateDataItem('twitter_app_name');
$this->assertEqual($twitter_app_name, "ThinkUp ". $_SERVER['SERVER_NAME']);
}

/**
Expand Down

0 comments on commit a15b3c5

Please sign in to comment.