Author: Jonathan.Wage
Date: 2010-02-18 04:23:06 +0100 (Thu, 18 Feb 2010)
New Revision: 28109

Added:
   plugins/sfSympalPlugin/trunk/test/functional/SitemapTest.php
   plugins/sfSympalPlugin/trunk/test/unit/SitemapTest.php
Removed:
   
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/modules/sympal_menu_items/templates/sitemapSuccess.php
Modified:
   
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/config/routing.yml
   
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/modules/sympal_menu_items/lib/Basesympal_menu_itemsActions.class.php
Log:
[1.4][sfSympalPlugin][1.0] Fixing sitemap.xml and adding tests


Modified: 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/config/routing.yml
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/config/routing.yml  
    2010-02-18 03:05:13 UTC (rev 28108)
+++ 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/config/routing.yml  
    2010-02-18 03:23:06 UTC (rev 28109)
@@ -20,8 +20,4 @@
     model:                sfSympalMenuItem
     module:               sympal_menu_items
     prefix_path:          admin/menus
-    with_wildcard_routes: true
-
-sympal_sitemap:
-  url: /sitemap
-  param: { module: sympal_menu_items, action: sitemap }
\ No newline at end of file
+    with_wildcard_routes: true
\ No newline at end of file

Modified: 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/modules/sympal_menu_items/lib/Basesympal_menu_itemsActions.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/modules/sympal_menu_items/lib/Basesympal_menu_itemsActions.class.php
    2010-02-18 03:05:13 UTC (rev 28108)
+++ 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/modules/sympal_menu_items/lib/Basesympal_menu_itemsActions.class.php
    2010-02-18 03:23:06 UTC (rev 28109)
@@ -118,13 +118,6 @@
     $this->redirect($request->getReferer());
   }
 
-  public function executeSitemap()
-  {
-    $table = Doctrine_Core::getTable('sfSympalMenuItem');
-    $this->menuItem = $table->findOneBySlug('sitemap');
-    $this->roots = $table->getTree()->fetchRoots();
-  }
-
   public function executeEdit(sfWebRequest $request)
   {
     $this->sf_sympal_menu_item = $this->_getMenuItem($request);

Deleted: 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/modules/sympal_menu_items/templates/sitemapSuccess.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/modules/sympal_menu_items/templates/sitemapSuccess.php
  2010-02-18 03:05:13 UTC (rev 28108)
+++ 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/modules/sympal_menu_items/templates/sitemapSuccess.php
  2010-02-18 03:23:06 UTC (rev 28109)
@@ -1,9 +0,0 @@
-<h2><?php echo __('Sitemap') ?></h2>
-
-<?php foreach ($roots as $root): ?>
-  <h3><?php echo ucfirst($root['name']) ?> <?php echo __('Menu') ?></h3>
-  <?php
-  $menu = get_sympal_menu($root['name'], true);
-  echo $menu;
-  ?>
-<?php endforeach; ?>
\ No newline at end of file

Added: plugins/sfSympalPlugin/trunk/test/functional/SitemapTest.php
===================================================================
--- plugins/sfSympalPlugin/trunk/test/functional/SitemapTest.php                
                (rev 0)
+++ plugins/sfSympalPlugin/trunk/test/functional/SitemapTest.php        
2010-02-18 03:23:06 UTC (rev 28109)
@@ -0,0 +1,18 @@
+<?php
+
+require_once(dirname(__FILE__).'/../bootstrap/functional.php');
+
+$browser = new sfSympalTestFunctional(new sfBrowser());
+$browser->
+  get('/sitemap.xml')->
+  with('response')->begin()->
+    isStatusCode('200')->
+    isValid()->
+    matches('/http:\/\//')->
+    matches('/sample-page/')->
+  end()->
+  with('request')->begin()->
+    isParameter('module', 'sympal_default')->
+    isParameter('action', 'sitemap')->
+  end()
+;
\ No newline at end of file

Added: plugins/sfSympalPlugin/trunk/test/unit/SitemapTest.php
===================================================================
--- plugins/sfSympalPlugin/trunk/test/unit/SitemapTest.php                      
        (rev 0)
+++ plugins/sfSympalPlugin/trunk/test/unit/SitemapTest.php      2010-02-18 
03:23:06 UTC (rev 28109)
@@ -0,0 +1,26 @@
+<?php
+
+$app = 'sympal';
+require_once(dirname(__FILE__).'/../bootstrap/unit.php');
+
+$t = new lime_test(2, new lime_output_color());
+
+class SitemapTest extends sfSympalSitemapGenerator
+{
+  protected function _getContent()
+  {
+    return Doctrine_Core::getTable('sfSympalContent')
+      ->createQuery('c')
+      ->select('c.*, t.*')
+      ->innerJoin('c.Type t')
+      ->where('c.slug = ?', 'sample-page')
+      ->execute();
+  }
+}
+
+$test = new SitemapTest($app);
+$xml = simplexml_load_string($test->generate());
+
+$loc = trim((string) $xml->url->loc);
+$t->is(strpos($loc, 'http://') !== false, true);
+$t->is(strpos($loc, 'sample-page') !== false, true);
\ 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