logo       

4088 - in trunk/Template: src/functions tests tests/custom_blocks tests/reg: msg#00258

web.ezcomponents.cvs

Subject: 4088 - in trunk/Template: src/functions tests tests/custom_blocks tests/regression_tests/custom_blocks/correct [eZComponents: Trunk]

Author: Jan Borsodi
Date: 2006-11-27 15:38:00 +0100 (Mon, 27 Nov 2006)
New Revision: 4088

Log:
- Fixed bug #9607: Custom blocks without a class in the definition generate
broken code.

Added:
trunk/Template/tests/custom_blocks/sha1.php
trunk/Template/tests/regression_tests/custom_blocks/correct/sha1.in
trunk/Template/tests/regression_tests/custom_blocks/correct/sha1.out
trunk/Template/tests/regression_tests/custom_blocks/correct/sha1.send
Modified:
trunk/Template/src/functions/functions.php
trunk/Template/tests/regression_test.php

Modified: trunk/Template/src/functions/functions.php
===================================================================
--- trunk/Template/src/functions/functions.php 2006-11-27 14:31:42 UTC (rev
4087)
+++ trunk/Template/src/functions/functions.php 2006-11-27 14:38:00 UTC (rev
4088)
@@ -251,7 +251,7 @@
throw new Exception( sprintf(
ezcTemplateSourceToTstErrorMessages::MSG_TOO_MANY_PARAMETERS, $functionName )
);
}

- $a = new ezcTemplateFunctionCallAstNode( $def->class . "::" .
$def->method);
+ $a = new ezcTemplateFunctionCallAstNode( ( $def->class ? (
$def->class . "::" ) : "" ) . $def->method);
$a->checkAndSetTypeHint();

foreach( $parameters as $p )

Added: trunk/Template/tests/custom_blocks/sha1.php
===================================================================
--- trunk/Template/tests/custom_blocks/sha1.php 2006-11-27 14:31:42 UTC (rev
4087)
+++ trunk/Template/tests/custom_blocks/sha1.php 2006-11-27 14:38:00 UTC (rev
4088)
@@ -0,0 +1,23 @@
+<?php
+ezcTestRunner::addFileToFilter( __FILE__ );
+
+class Sha1CustomBlock implements ezcTemplateCustomFunction
+{
+ public static function getCustomFunctionDefinition($name)
+ {
+ switch ($name)
+ {
+ case "str_sha1":
+ $def = new ezcTemplateCustomFunctionDefinition();
+ $def->class = false;
+ $def->method = "sha1";
+ $def->parameters[] = "text";
+ return $def;
+ }
+ }
+
+}
+
+
+
+?>


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

Modified: trunk/Template/tests/regression_test.php
===================================================================
--- trunk/Template/tests/regression_test.php 2006-11-27 14:31:42 UTC (rev
4087)
+++ trunk/Template/tests/regression_test.php 2006-11-27 14:38:00 UTC (rev
4088)
@@ -20,6 +20,7 @@
include_once ("custom_blocks/testblocks.php");
include_once ("custom_blocks/links.php");
include_once ("custom_blocks/cblock.php");
+include_once ("custom_blocks/sha1.php");

class ezcTemplateRegressionTest extends ezcTestCase
{
@@ -388,6 +389,7 @@
$template->configuration->addExtension( "TestBlocks" );
$template->configuration->addExtension( "LinksCustomBlock" );
$template->configuration->addExtension( "cblockTemplateExtension"
);
+ $template->configuration->addExtension( "Sha1CustomBlock" );

if( preg_match("#^(\w+)@(\w+)\..*$#", $base, $match ) )
{

Added: trunk/Template/tests/regression_tests/custom_blocks/correct/sha1.in
===================================================================
--- trunk/Template/tests/regression_tests/custom_blocks/correct/sha1.in
2006-11-27 14:31:42 UTC (rev 4087)
+++ trunk/Template/tests/regression_tests/custom_blocks/correct/sha1.in
2006-11-27 14:38:00 UTC (rev 4088)
@@ -0,0 +1,3 @@
+{use $text}
+Text: {$text}
+SHA1: {str_sha1( $text )}

Added: trunk/Template/tests/regression_tests/custom_blocks/correct/sha1.out
===================================================================
--- trunk/Template/tests/regression_tests/custom_blocks/correct/sha1.out
2006-11-27 14:31:42 UTC (rev 4087)
+++ trunk/Template/tests/regression_tests/custom_blocks/correct/sha1.out
2006-11-27 14:38:00 UTC (rev 4088)
@@ -0,0 +1,2 @@
+Text: Text for SHA1
+SHA1: 475a94642ce2ea9683cccdcfbf430265bd7afbd9

Added: trunk/Template/tests/regression_tests/custom_blocks/correct/sha1.send
===================================================================
--- trunk/Template/tests/regression_tests/custom_blocks/correct/sha1.send
2006-11-27 14:31:42 UTC (rev 4087)
+++ trunk/Template/tests/regression_tests/custom_blocks/correct/sha1.send
2006-11-27 14:38:00 UTC (rev 4088)
@@ -0,0 +1,7 @@
+<?php
+
+$v = new ezcTemplateVariableCollection();
+$v->text = "Text for SHA1";
+
+return $v;
+?>



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise