Author: Jonathan.Wage
Date: 2010-01-23 04:56:47 +0100 (Sat, 23 Jan 2010)
New Revision: 27082

Modified:
   
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/modules/sympal_install/lib/sfSympalInstallForm.class.php
   
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/modules/sympal_install/templates/indexSuccess.php
   
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenuSiteManager.class.php
   plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php
   plugins/sfSympalPlugin/trunk/test/functional/ActionsTest.php
   plugins/sfSympalPlugin/trunk/test/functional/ConfigurationTest.php
Log:
[1.4][sfSympalPlugin][1.0] Fixing tests


Modified: 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/modules/sympal_install/lib/sfSympalInstallForm.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/modules/sympal_install/lib/sfSympalInstallForm.class.php
     2010-01-23 01:20:20 UTC (rev 27081)
+++ 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/modules/sympal_install/lib/sfSympalInstallForm.class.php
     2010-01-23 03:56:47 UTC (rev 27082)
@@ -4,7 +4,6 @@
 {
   public function setup()
   {
-    $this->embedForm('setup', new sfSympalSetupInstallForm());
     $this->embedForm('user', new sfSympalUserInstallForm());
     $this->embedForm('database', new sfSympalDatabaseInstallForm());
 
@@ -16,78 +15,6 @@
   }  
 }
 
-class sfSympalSetupInstallForm extends BaseForm
-{
-  public function formatPluginName($name)
-  {
-    return 
sfInflector::humanize(sfInflector::underscore(sfSympalPluginToolkit::getShortPluginName($name)));
-  }
-
-  public function getWidgetPluginChoices()
-  {
-    $plugins = 
sfSympalContext::getInstance()->getSympalConfiguration()->getAddonPlugins();
-    $plugins = array_combine($plugins, $plugins);
-    $plugins = array_map(array($this, 'formatPluginName'), $plugins);
-
-    return $plugins;
-  }
-
-  public function setup()
-  {
-    $plugins = $this->getWidgetPluginChoices();
-
-    $this->setWidgets(array(
-      'plugins'           => new 
sfSympalInstallPluginsChoiceWidget(array('multiple' => true, 'expanded' => 
true, 'choices' => $plugins)),
-    ));
-
-    $this->setValidators(array(
-      'plugins'           => new sfValidatorChoice(array('required' => false, 
'multiple' => true, 'choices' => array_keys($plugins))),
-    ));
-
-    $this->widgetSchema->setNameFormat('install[%s]');
-
-    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
-
-    $this->mergePostValidator(new sfValidatorSchemaCompare('password', 
sfValidatorSchemaCompare::EQUAL, 'password_again', array(), array('invalid' => 
'The two passwords must be the same.')));
-
-    parent::setup();
-  }
-}
-
-class sfSympalInstallPluginsChoiceWidget extends sfWidgetFormChoice
-{
-  public function render($name, $value = null, $attributes = array(), $errors 
= array())
-  {
-    if ($this->getOption('multiple'))
-    {
-      $attributes['multiple'] = 'multiple';
-  
-      if ('[]' != substr($name, -2))
-      {
-        $name .= '[]';
-      }
-    }
-
-    $choices = $this->getOption('choices');
-    if ($choices instanceof sfCallable)
-    {
-      $choices = $choices->call();
-    }
-
-    $html = '<table>';
-    $html .= '<thead><tr><th></th><th>Plugin</th><th>Author</th></tr>';
-    $html .= '<tbody>';
-    foreach ($choices as $pluginName => $title)
-    {
-      $info = new sfSympalPluginInfo($pluginName);
-      $html .= '<tr><td><input type="checkbox" name="'.$name.'" 
value="'.$pluginName.'" '.(in_array($pluginName, (array) $value) ? 
'checked="checked"' : null).' /></td><td><strong>'.link_to($info->getTitle(), 
$info->getUrl(), 
'target=_BLANK').'</strong><br/><small>'.$info->getDescription().'</small></td><td>'.$info->getAuthor().'</td></tr?>';
-    }
-    $html .= '</tbody>';
-    $html .= '</table>';
-    return $html;
-  }
-}
-
 class sfSympalUserInstallForm extends BaseForm
 {
   public function setup()

Modified: 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/modules/sympal_install/templates/indexSuccess.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/modules/sympal_install/templates/indexSuccess.php
    2010-01-23 01:20:20 UTC (rev 27081)
+++ 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/modules/sympal_install/templates/indexSuccess.php
    2010-01-23 03:56:47 UTC (rev 27082)
@@ -23,14 +23,6 @@
     </table>
   </div>
 
-  <div id="plugins">
-    <h2>Choose Additional Plugins to Install</h2>
-
-    <table>
-      <?php echo $form['setup']['plugins'] ?>
-    </table>
-  </div>
-
   <br style="clear: both;" />
   <input type="submit" name="install_now" value="Install Now" />
 </form>
\ No newline at end of file

Modified: 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenuSiteManager.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenuSiteManager.class.php
      2010-01-23 01:20:20 UTC (rev 27081)
+++ 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenuSiteManager.class.php
      2010-01-23 03:56:47 UTC (rev 27082)
@@ -64,15 +64,15 @@
 
   protected function _getMenu($name, $showChildren = null, $class = null)
   {
-    if (!$name)
+    if ($name instanceof sfSympalMenuItem)
     {
-      return false;
+      $menuItem = $name;
+      $name = $name['root_id'] && isset($this->_rootSlugs[$name['root_id']]) ? 
$this->_rootSlugs[$name['root_id']] : false;
     }
 
-    if ($name instanceof sfSympalMenuItem)
+    if (!$name)
     {
-      $menuItem = $name;
-      $name = $this->_rootSlugs[$name['root_id']];
+      return false;
     }
 
     $cacheKey = 'SYMPAL_MENU_'.md5($name.var_export($showChildren, 
true).$class);

Modified: plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php    
2010-01-23 01:20:20 UTC (rev 27081)
+++ plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php    
2010-01-23 03:56:47 UTC (rev 27082)
@@ -120,6 +120,10 @@
 
   public function filterTemplateParameters(sfEvent $event, $parameters)
   {
+    if (!$this->_sympalContext)
+    {
+      return $parameters;
+    }
     $parameters['sf_sympal_context'] = $this->_sympalContext;
     if ($content = $this->_sympalContext->getCurrentContent())
     {

Modified: plugins/sfSympalPlugin/trunk/test/functional/ActionsTest.php
===================================================================
--- plugins/sfSympalPlugin/trunk/test/functional/ActionsTest.php        
2010-01-23 01:20:20 UTC (rev 27081)
+++ plugins/sfSympalPlugin/trunk/test/functional/ActionsTest.php        
2010-01-23 03:56:47 UTC (rev 27082)
@@ -75,6 +75,7 @@
 ;
 
 $browser->
+  get('/')->
   call('/change_language/fr')->
   with('response')->begin()->
     isRedirected()->
@@ -86,6 +87,7 @@
 ;
 
 $browser->
+  get('/')->
   post('/change_language', array('language' => 'es'))->
   with('response')->begin()->
     isRedirected()->

Modified: plugins/sfSympalPlugin/trunk/test/functional/ConfigurationTest.php
===================================================================
--- plugins/sfSympalPlugin/trunk/test/functional/ConfigurationTest.php  
2010-01-23 01:20:20 UTC (rev 27081)
+++ plugins/sfSympalPlugin/trunk/test/functional/ConfigurationTest.php  
2010-01-23 03:56:47 UTC (rev 27082)
@@ -7,12 +7,12 @@
 
 $browser->
   get('/admin/configuration')->
-  click('Save', array('settings' => array('breadcrumbs_separator' => ' :: ', 
'plugin_api' => array('username' => 'test', 'password' => 'test'))))
+  click('Save', array('settings' => array('breadcrumbs_separator' => ' / ', 
'plugin_api' => array('username' => 'test', 'password' => 'test'))))
 ;
 
 $after = sfYaml::load(sfConfig::get('sf_app_dir').'/config/app.yml');
 $t = $browser->test();
-$t->is($after['all']['sympal_config']['breadcrumbs_separator'], ' :: ', 'Test 
breadcrumbs separator saved');
+$t->is($after['all']['sympal_config']['breadcrumbs_separator'], ' / ', 'Test 
breadcrumbs separator saved');
 $t->is($after['all']['sympal_config']['plugin_api']['username'], 'test', 'Test 
plugin_api.username saved');
 $t->is($after['all']['sympal_config']['plugin_api']['password'], 'test', 'Test 
plugin_api.password saved');
 

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to