public function testOutput()
 {
     //not logged in
     $controller = new TwitterPluginHashtagConfigurationController(null, 'twitter', 'ginatrapani');
     $output = $controller->go();
     $v_mgr = $controller->getViewManager();
     $config = Config::getInstance();
     $this->assertEqual('You must <a href="' . $config->getValue('site_root_path') . 'session/login.php">log in</a> to do this.', $v_mgr->getTemplateDataItem('error_msg'));
     //logged in, no user set up
     $this->simulateLogin('*****@*****.**');
     $owner_dao = DAOFactory::getDAO('OwnerDAO');
     $owner = $owner_dao->getByEmail(Session::getLoggedInUser());
     $controller = new TwitterPluginHashtagConfigurationController(null, 'twitter', 'ginatrapani');
     $output = $controller->go();
     $v_mgr = $controller->getViewManager();
     $this->assertIsA($v_mgr->getTemplateDataItem('user'), 'string');
     $this->assertEqual('Twitter user @ginatrapani does not exist.', $v_mgr->getTemplateDataItem('error_msg'));
     //logged in, user set up
     $builders = array();
     $builders[] = FixtureBuilder::build('instances', array('network_username' => 'ginatrapani', 'network' => 'twitter'));
     $controller = new TwitterPluginHashtagConfigurationController(null, 'twitter', 'ginatrapani');
     $output = $controller->go();
     $v_mgr = $controller->getViewManager();
     $this->assertIsA($v_mgr->getTemplateDataItem('user'), 'string');
     $this->assertIsA($v_mgr->getTemplateDataItem('hashtags'), 'array');
 }
 public function testOutput()
 {
     //not logged in
     $controller = new TwitterPluginHashtagConfigurationController(null, 'twitter', 'ginatrapani');
     $output = $controller->go();
     $this->assertPattern('/session\\/login.php\\?redirect\\=/', $controller->redirect_destination);
     //logged in, no user set up
     $this->simulateLogin('*****@*****.**');
     $owner_dao = DAOFactory::getDAO('OwnerDAO');
     $owner = $owner_dao->getByEmail(Session::getLoggedInUser());
     $controller = new TwitterPluginHashtagConfigurationController(null, 'twitter', 'ginatrapani');
     $output = $controller->go();
     $v_mgr = $controller->getViewManager();
     $this->assertIsA($v_mgr->getTemplateDataItem('user'), 'string');
     $this->assertEqual('Twitter user @ginatrapani does not exist.', $v_mgr->getTemplateDataItem('error_msg'));
     //logged in, user set up
     $builders = array();
     $builders[] = FixtureBuilder::build('instances', array('network_username' => 'ginatrapani', 'network' => 'twitter'));
     $controller = new TwitterPluginHashtagConfigurationController(null, 'twitter', 'ginatrapani');
     $output = $controller->go();
     $v_mgr = $controller->getViewManager();
     $this->assertIsA($v_mgr->getTemplateDataItem('user'), 'string');
     $this->assertIsA($v_mgr->getTemplateDataItem('hashtags'), 'array');
 }
Пример #3
0
 public function renderInstanceConfiguration($owner, $instance_username, $instance_network)
 {
     $controller = new TwitterPluginHashtagConfigurationController($owner, 'twitter', $instance_username);
     return $controller->go();
 }