public function testOutputNoParams()
 {
     // build some options data
     $options_arry = $this->buildPluginOptions();
     //not logged in, no owner set
     $controller = new FlickrThumbnailsPluginConfigurationController(null, 'flickrthumbnails');
     $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('errormsg'));
     //logged in
     $this->simulateLogin('*****@*****.**');
     $owner_dao = DAOFactory::getDAO('OwnerDAO');
     $owner = $owner_dao->getByEmail(Session::getLoggedInUser());
     $controller = new FlickrThumbnailsPluginConfigurationController($owner, 'flickrthumbnails');
     $output = $controller->go();
     $this->assertPattern('/Flickr API key/', $output);
 }
    /**
     * Test config isa admin
     */
    public function testConfigOptionsIsAdmin() {
        // build some options data
        $this->simulateLogin('*****@*****.**', $isadmin = true);
        $owner_dao = DAOFactory::getDAO('OwnerDAO');
        $owner = $owner_dao->getByEmail(Session::getLoggedInUser());
        $controller = new FlickrThumbnailsPluginConfigurationController($owner, 'flickrthumbnails');
        $output = $controller->go();
        // we have a text form element with proper data
        $this->assertPattern('/save options/', $output); // should have submit option
        $this->assertPattern('/plugin_options_error_flickr_api_key/', $output); // should have api key option
        $this->assertPattern('/var is_admin = true/', $output); // is a js admin

        //app not configured
        $controller = new FlickrThumbnailsPluginConfigurationController($owner, 'flickrthumbnails');
        $output = $controller->go();
        $this->assertPattern('/var required_values_set = false/', $output); // is not configured
    }
 public function renderConfiguration($owner)
 {
     $controller = new FlickrThumbnailsPluginConfigurationController($owner, 'flickrthumbnails');
     return $controller->go();
 }