예제 #1
0
 public function renderConfiguration($owner)
 {
     $controller = new YouTubePluginConfigurationController($owner);
     return $controller->go();
 }
 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 YouTubePluginConfigurationController($owner);
     $output = $controller->go();
     // 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_youtube_client_secret/', $output);
     // secret option
     $this->assertPattern('/plugin_options_error_message_youtube_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 = 'youtube'";
     $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 YouTubePluginConfigurationController($owner);
     $output = $controller->go();
     $this->assertPattern('/var required_values_set = false/', $output);
     // is not configured
 }