Author: Jonathan.Wage
Date: 2010-02-17 11:52:55 +0100 (Wed, 17 Feb 2010)
New Revision: 28074

Modified:
   
plugins/sfSympalPlugin/trunk/lib/form/doctrine/PluginsfSympalContentTypeForm.class.php
   plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php
   plugins/sfSympalPlugin/trunk/test/unit/ConfigurationTest.php
Log:
[1.4][sfSympalPlugin][1.0] Adding again the new configuration tests


Modified: 
plugins/sfSympalPlugin/trunk/lib/form/doctrine/PluginsfSympalContentTypeForm.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/form/doctrine/PluginsfSympalContentTypeForm.class.php
      2010-02-17 10:27:31 UTC (rev 28073)
+++ 
plugins/sfSympalPlugin/trunk/lib/form/doctrine/PluginsfSympalContentTypeForm.class.php
      2010-02-17 10:52:55 UTC (rev 28074)
@@ -14,6 +14,7 @@
     parent::setup();
 
     $plugins = 
sfSympalContext::getInstance()->getSympalConfiguration()->getContentTypePlugins();
+    $plugins = array_combine($plugins, $plugins);
     $plugins = array_merge(array('' => ''), $plugins);
 
     $this->widgetSchema['plugin_name'] = new 
sfWidgetFormChoice(array('choices' => $plugins));

Modified: plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php    
2010-02-17 10:27:31 UTC (rev 28073)
+++ plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php    
2010-02-17 10:52:55 UTC (rev 28074)
@@ -290,7 +290,7 @@
       $manager = new sfSympalPluginManager($plugin, 
$this->_projectConfiguration, new sfFormatter());
       if ($contentType = $manager->getContentTypeForPlugin())
       {
-        $contentTypePlugins[$plugin] = $plugin;
+        $contentTypePlugins[] = $plugin;
       }
     }
     return $contentTypePlugins;

Modified: plugins/sfSympalPlugin/trunk/test/unit/ConfigurationTest.php
===================================================================
--- plugins/sfSympalPlugin/trunk/test/unit/ConfigurationTest.php        
2010-02-17 10:27:31 UTC (rev 28073)
+++ plugins/sfSympalPlugin/trunk/test/unit/ConfigurationTest.php        
2010-02-17 10:52:55 UTC (rev 28074)
@@ -13,11 +13,36 @@
 $app = 'sympal';
 require_once(dirname(__FILE__).'/../bootstrap/unit.php');
 
-$t = new lime_test(9, new lime_output_color());
+$t = new lime_test(22, new lime_output_color());
 
 $sympalPluginConfiguration = 
sfContext::getInstance()->getConfiguration()->getPluginConfiguration('sfSympalPlugin');
 $sympalConfiguration = $sympalPluginConfiguration->getSympalConfiguration();
 
+$themes = $sympalConfiguration->getThemes(); 
+$t->is(isset($themes['default']), true, '->getThemes() includes default 
theme'); 
+ 
+$availableThemes = $sympalConfiguration->getAvailableThemes(); 
+$t->is(isset($themes['admin']), 'admin', '->getAvailableThemes() does not 
include admin theme'); 
+ 
+$contentTemplates = $sympalConfiguration->getContentTemplates('page'); 
+$t->is(isset($contentTemplates['default_view']), true, 
'->getContentTemplates() returns default_view for page'); 
+$t->is(isset($contentTemplates['register']), true, '->getContentTemplates() 
returns register for page'); 
+ 
+sfContext::getInstance()->getRequest()->setParameter('module', 
'sympal_dashboard'); 
+$t->is($sympalConfiguration->isAdminModule(), true, '->isAdminModule() returns 
true for admin module'); 
+ 
+sfContext::getInstance()->getRequest()->setParameter('module', 
'sympal_content_renderer'); 
+$t->is($sympalConfiguration->isAdminModule(), false, '->isAdminModule() 
returns false for non-admin module'); 
+ 
+$plugins = $sympalConfiguration->getPlugins(); 
+$t->is(is_array($plugins), true, '->getPlugins() returns array'); 
+$t->is(in_array('sfSympalBlogPlugin', $plugins), true, '->getPlugins() 
includes sfSympalBlogPlugin'); 
+ 
+$pluginPaths = $sympalConfiguration->getPluginPaths(); 
+$t->is(is_array($pluginPaths), true, '->getPluginPaths() returns array'); 
+$t->is(isset($pluginPaths['sfSympalBlogPlugin']), true, '->getPluginPaths() 
includes sfSympalBlogPlugin'); 
+$t->is($pluginPaths['sfSympalBlogPlugin'], 
sfConfig::get('sf_plugins_dir').'/sfSympalBlogPlugin', '->getPluginPaths() 
returns correct path as value of array');
+       
 $requiredPlugins = array(
   'sfSympalPlugin',
   'sfSympalUserPlugin',
@@ -101,4 +126,14 @@
 $t->is(in_array('sympal_content_renderer', $modules), true, '->getModules() 
returns an array with sympal_content_renderer as an entry');
 
 $layouts = $sympalConfiguration->getLayouts();
-$t->is(in_array('sympal', $layouts), true, '->getLayouts() returns an array 
with "sympal" as one of its entries');
\ No newline at end of file
+$t->is(in_array('sympal', $layouts), true, '->getLayouts() returns an array 
with "sympal" as one of its entries');
+
+$contentTypePlugins = $sympalConfiguration->getContentTypePlugins(); 
+$t->is($contentTypePlugins, array( 
+  'sfSympalBlogPlugin', 
+  'sfSympalPagesPlugin', 
+  'sfSympalContentListPlugin' 
+), '->getContentTypePlugins() returns the correct array of plugins with 
content typed defined'); 
+ 
+$allManageablePlugins = $sympalConfiguration->getAllManageablePlugins(); 
+$t->is(in_array('sfSympalBlogPlugin', $allManageablePlugins), true, 
'->getAllManageablePlugins() returns the correct array of plugins');
\ No newline at end of file

-- 
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