public function testLoggedInAllParams() {
        $this->simulateLogin('*****@*****.**');
        $_GET['oauth_token'] = 'XXX';
        $_SESSION['oauth_request_token_secret'] = 'XXX';

        $owner_builder = FixtureBuilder::build('owners', array('id'=>'10', 'email'=>'*****@*****.**'));
        $namespace = OptionDAO::PLUGIN_OPTIONS . '-1';
        $plugn_opt_builder1 = FixtureBuilder::build('options', array('namespace'=>$namespace,
        'option_name'=>'oauth_consumer_key', 'option_value'=>'XXX'));
        $plugn_opt_builder2 = FixtureBuilder::build('options', array('namespace'=>$namespace,
        'option_name'=>'oauth_consumer_secret', 'option_value'=>'YYY'));
        $plugn_opt_builder3 = FixtureBuilder::build('options', array('namespace'=>$namespace,
        'option_name'=>'num_twitter_errors', 'option_value'=>'5'));
        $plugn_opt_builder4 = FixtureBuilder::build('options', array('namespace'=>$namespace,
        'option_name'=>'max_api_calls_per_crawl', 'option_value'=>'350'));

        $controller = new TwitterAuthController(true);
        $results = $controller->go();

        $v_mgr = $controller->getViewManager();
        $results = $v_mgr->getTemplateDataItem('infomsg');
        $this->assertTrue(strpos($results, 'Twitter authentication successful!')>0);
        $this->assertTrue(strpos($results, 'Instance does not exist.')>0);
        $this->assertTrue(strpos($results, 'Created instance.')>0);
    }
示例#2
0
文件: auth.php 项目: rayyan/ThinkUp
<?php

chdir("..");
chdir("..");
require_once 'init.php';
require_once 'plugins/twitter/controller/class.TwitterAuthController.php';
$controller = new TwitterAuthController();
echo $controller->go();
 public function testLoggedInAllParamsServiceUserExists()
 {
     $this->simulateLogin('*****@*****.**');
     $_GET['oauth_token'] = 'XXX';
     SessionCache::put('oauth_request_token_secret', 'XXX');
     $builders[] = FixtureBuilder::build('owners', array('id' => '10', 'email' => '*****@*****.**'));
     $namespace = OptionDAO::PLUGIN_OPTIONS . '-1';
     $builders[] = FixtureBuilder::build('options', array('namespace' => $namespace, 'option_name' => 'oauth_consumer_key', 'option_value' => 'XXX'));
     $builders[] = FixtureBuilder::build('options', array('namespace' => $namespace, 'option_name' => 'oauth_consumer_secret', 'option_value' => 'YYY'));
     $builders[] = FixtureBuilder::build('options', array('namespace' => $namespace, 'option_name' => 'num_twitter_errors', 'option_value' => '5'));
     $builders[] = FixtureBuilder::build('options', array('namespace' => $namespace, 'option_name' => 'max_api_calls_per_crawl', 'option_value' => '350'));
     $builders[] = FixtureBuilder::build('instances', array('network_user_id' => '1401881', 'network_username' => 'dougw', 'network' => 'twitter'));
     $builders[] = FixtureBuilder::build('instances_twitter', array('last_page_fetched_replies' => 1));
     $builders[] = FixtureBuilder::build('owner_instances', array('instance_id' => 1, 'owner_id' => 10));
     $controller = new TwitterAuthController(true);
     $results = $controller->go();
     $v_mgr = $controller->getViewManager();
     $this->debug($results);
     $this->assertEqual('dougw on Twitter is already set up in ThinkUp! To add a different Twitter account, log ' . 'out of Twitter.com in your browser and authorize ThinkUp again.', $v_mgr->getTemplateDataItem('success_msg'));
 }