Author: Raymond Bosman
Date: 2006-08-30 14:43:07 +0200 (Wed, 30 Aug 2006)
New Revision: 3420

Log:
- Added a small test case for the "link_to" custom block.

Added:
   trunk/Template/tests/custom_blocks/links.php
   trunk/Template/tests/regression_tests/custom_blocks/correct/[EMAIL PROTECTED]
   trunk/Template/tests/regression_tests/custom_blocks/correct/[EMAIL PROTECTED]
Modified:
   trunk/Template/tests/regression_test.php

Added: trunk/Template/tests/custom_blocks/links.php
===================================================================
--- trunk/Template/tests/custom_blocks/links.php        2006-08-30 12:02:42 UTC 
(rev 3419)
+++ trunk/Template/tests/custom_blocks/links.php        2006-08-30 12:43:07 UTC 
(rev 3420)
@@ -0,0 +1,47 @@
+<?php
+ezcTestRunner::addFileToFilter( __FILE__ );
+
+class LinksCustomBlock implements ezcTemplateCustomFunction, 
ezcTemplateCustomBlock
+{
+    public static function getCustomFunctionDefinition($name)
+    {
+        switch ($name)
+        {
+            case "link_to":
+                $def = new ezcTemplateCustomFunctionDefinition();
+                $def->class = __CLASS__;
+                $def->method = "link_to";
+                $def->parameters[] = "name";
+                $def->parameters[] = "url";
+                return $def;
+        }
+    }
+
+    public static function getCustomBlockDefinition($name)
+    {
+        switch ($name)
+        {
+            case "link":
+                $def = new ezcTemplateCustomBlockDefinition();
+                $def->class = __CLASS__;
+                $def->method = "linkCustomBlock";
+                $def->startExpressionName = "from";
+                $def->requiredParameters = array("from", "to" );
+                return $def;
+        }
+    }
+   
+    public static function link_to($name, $url)
+    {
+        return "<a href=\"".$url."\">".$name."</a>";
+    }
+
+    public static function linkCustomBlock( $parameters )
+    {
+        return self::link_to( $parameters["from"], $parameters["to"] );
+    }
+}
+
+
+
+?>


Property changes on: trunk/Template/tests/custom_blocks/links.php
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/Template/tests/regression_test.php
===================================================================
--- trunk/Template/tests/regression_test.php    2006-08-30 12:02:42 UTC (rev 
3419)
+++ trunk/Template/tests/regression_test.php    2006-08-30 12:43:07 UTC (rev 
3420)
@@ -14,11 +14,12 @@
  */
 include_once ("custom_blocks/testblocks.php");
 include_once ("custom_blocks/brainfuck.php");
+include_once ("custom_blocks/links.php");
 class ezcTemplateRegressionTest extends ezcTestCase
 {
-    public $requestRegeneration = false;
+    public $requestRegeneration = true;
 
-    public $showTreesOnFailure = true;
+    public $showTreesOnFailure = false;
 
     private $stdin = null;
 
@@ -103,8 +104,8 @@
             $template->configuration = new ezcTemplateConfiguration( $dir, 
$this->getTempDir() );
             $template->configuration->addExtension( "BrainFuck" );
             $template->configuration->addExtension( "TestBlocks" );
+            $template->configuration->addExtension( "LinksCustomBlock" );
 
-
             if( preg_match("#^(\w+)@(\w+)\..*$#", $base, $match ) )
             {
                 $contextClass = "ezcTemplate". ucfirst( strtolower( $match[2] 
) ) . "Context";

Added: trunk/Template/tests/regression_tests/custom_blocks/correct/[EMAIL 
PROTECTED]
===================================================================
--- trunk/Template/tests/regression_tests/custom_blocks/correct/[EMAIL 
PROTECTED]       2006-08-30 12:02:42 UTC (rev 3419)
+++ trunk/Template/tests/regression_tests/custom_blocks/correct/[EMAIL 
PROTECTED]       2006-08-30 12:43:07 UTC (rev 3420)
@@ -0,0 +1 @@
+More people should check the following site: {link "eZ" to "http://ez.no"} 
<br/>


Property changes on: 
trunk/Template/tests/regression_tests/custom_blocks/correct/[EMAIL PROTECTED]
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/Template/tests/regression_tests/custom_blocks/correct/[EMAIL 
PROTECTED]
===================================================================
--- trunk/Template/tests/regression_tests/custom_blocks/correct/[EMAIL 
PROTECTED]       2006-08-30 12:02:42 UTC (rev 3419)
+++ trunk/Template/tests/regression_tests/custom_blocks/correct/[EMAIL 
PROTECTED]       2006-08-30 12:43:07 UTC (rev 3420)
@@ -0,0 +1 @@
+More people should check the following site: <a href="http://ez.no";>eZ</a> 
<br/>


Property changes on: 
trunk/Template/tests/regression_tests/custom_blocks/correct/[EMAIL PROTECTED]
___________________________________________________________________
Name: svn:eol-style
   + native

-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to