Author: FrankStelzer
Date: 2010-05-09 22:25:30 +0200 (Sun, 09 May 2010)
New Revision: 29402

Modified:
   plugins/sfPHPUnit2Plugin/trunk/lib/task/sfPHPUnitGenerateBaseTask.class.php
Log:
[sfPHPUnit2Plugin] added possibility to define and load custom templates

Modified: 
plugins/sfPHPUnit2Plugin/trunk/lib/task/sfPHPUnitGenerateBaseTask.class.php
===================================================================
--- plugins/sfPHPUnit2Plugin/trunk/lib/task/sfPHPUnitGenerateBaseTask.class.php 
2010-05-09 08:10:16 UTC (rev 29401)
+++ plugins/sfPHPUnit2Plugin/trunk/lib/task/sfPHPUnitGenerateBaseTask.class.php 
2010-05-09 20:25:30 UTC (rev 29402)
@@ -29,6 +29,16 @@
   }
 
   /**
+   * Returns data dir of project
+   *
+   * @return string
+   */
+  protected function getProjectDataDir()
+  {
+    return sfConfig::get('sf_data_dir');
+  }
+
+  /**
    * Returns the test dir to the PHPUnit test cases
    *
    * @return string
@@ -71,9 +81,17 @@
    */
   protected function getTemplate( $templateName )
   {
-    $templatePath = $this->getPluginDir().'/data/template/' . $templateName;
+    // check if template does exist in custom dir
+    $templatePath = $this->getProjectDataDir().'/sfPHPUnit2Plugin/template/' . 
$templateName;
+
+    // custom template does not exist, take the plugin template
     if (!file_exists($templatePath))
     {
+      $templatePath = $this->getPluginDir().'/data/template/' . $templateName;
+    }
+
+    if (!file_exists($templatePath))
+    {
       throw new sfCommandException(sprintf('Template "%s" does not exist.', 
$templateName));
     }
 

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