[limb-svn] r4164 - in 3.x/packages/wact/trunk: framework/template/compiler framework/template/compiler/compile_tree_node framework/template/compiler/parser framework/template/compiler/tags framework/template/components/data framework/template/tags/form tests/cases/template/compiler tests/cases/template/compiler/attribute tests/cases/template/compiler/expression tests/cases/template/compiler/tags
svn at limb-project.com
svn at limb-project.com
Mon Oct 16 11:28:34 MSD 2006
Author: serega
Date: 2006-10-16 11:28:34 +0400 (Mon, 16 Oct 2006)
New Revision: 4164
Added:
3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerTreeRootNode.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/CompileTreeNodeTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/CompilerTreeRootNodeTest.class.php
Removed:
3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/ComponentTree.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/CompilerComponentTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/ComponentTreeTest.class.php
Modified:
3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerComponent.class.php
3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/OutputExpression.class.php
3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/PHPNode.class.php
3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/TextNode.class.php
3.x/packages/wact/trunk/framework/template/compiler/parser/SourceFileParser.class.php
3.x/packages/wact/trunk/framework/template/compiler/parser/WactNodeBuilder.class.php
3.x/packages/wact/trunk/framework/template/compiler/parser/WactTreeBuilder.class.php
3.x/packages/wact/trunk/framework/template/compiler/tags/CompilerTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tags/SilentCompilerDirectiveTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/templatecompiler.inc.php
3.x/packages/wact/trunk/framework/template/components/data/data_table.inc.php
3.x/packages/wact/trunk/framework/template/tags/form/inputautocomplete.tag.php
3.x/packages/wact/trunk/tests/cases/template/compiler/PHPNodeTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/TextNodeTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/WactComponentParsingStateTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/WactTreeBuilderTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/attribute/AttributeExpressionTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/expression/DataBindingExpressionTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/expression/ExpressionTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tags/CompilerDirectiveTagTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tags/CompilerTagTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tags/ServerComponentTagTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tags/ServerTagComponentTagTest.class.php
Log:
-- -- WACT package clean up and refactoring
Modified: 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerComponent.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerComponent.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerComponent.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -5,7 +5,7 @@
//--------------------------------------------------------------------------------
/**
* @package WACT_TEMPLATE
-* @version $Id: CompilerComponent.class.php,v 1.60 2006/01/04 23:40:33 ian_w_white Exp $
+* @version $Id: CompileTreeNode.class.php,v 1.60 2006/01/04 23:40:33 ian_w_white Exp $
*/
/**
@@ -14,12 +14,12 @@
* Note this in the comments for this class, parent and child refer to the XML
* heirarchy in the template, as opposed to the PHP class tree.
* @see SourceFileParser
-* @see http://wact.sourceforge.net/index.php/CompilerComponent
+* @see http://wact.sourceforge.net/index.php/CompileTreeNode
* @access public
* @abstract
* @package WACT_TEMPLATE
*/
-class CompilerComponent {
+class CompileTreeNode {
/**
* XML attributes of the tag
* @var array
@@ -43,7 +43,7 @@
/**
* Parent compile-time component
- * @var object subclass of CompilerComponent
+ * @var object subclass of CompileTreeNode
* @access private
*/
var $parent = NULL;
@@ -322,7 +322,7 @@
/**
* Provides instruction to the template parser, while parsing is in
* progress, telling it how it should handle the tag. Subclasses of
- * CompilerComponent will return different instructions.<br />
+ * CompileTreeNode will return different instructions.<br />
* Available instructions are;
* <ul>
* <li>PARSER_REQUIRE_PARSING - default in this class. Tag must be parsed</li>
Copied: 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerTreeRootNode.class.php (from rev 4163, 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/ComponentTree.class.php)
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerTreeRootNode.class.php (rev 0)
+++ 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerTreeRootNode.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -0,0 +1,24 @@
+<?php
+class CompileTreeRootNode extends CompileTreeNode
+{
+ function getComponentRefCode()
+ {
+ return '$root';
+ }
+
+ function getDataSourceRefCode()
+ {
+ return '$root->_datasource';
+ }
+
+ function getDataSource() {
+ return $this;
+ }
+
+ function isDataSource()
+ {
+ return TRUE;
+ }
+
+}
+?>
\ No newline at end of file
Deleted: 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/ComponentTree.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/ComponentTree.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/ComponentTree.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -1,47 +0,0 @@
-<?php
-/**
-* The root compile time component in the template hierarchy.
-* @see http://wact.sourceforge.net/index.php/CompilerTreeRootNode
-* @access public
-* @package WACT_TEMPLATE
-*/
-class CompilerTreeRootNode extends CompilerComponent
-{
-
- /**
- * Returns the base for building the PHP runtime component reference string
- * @param CodeWriter
- * @return string
- * @access protected
- */
- function getComponentRefCode() {
- return '$root';
- }
-
- /**
- * @param CodeWriter
- * @return string
- * @access protected
- */
- function getDataSourceRefCode() {
- return '$root->_datasource';
- }
-
- /**
- * Returns this instance of CompilerTreeRootNode
- * @return CompilerTreeRootNode this instance
- * @access protected
- */
- function &getDataSource() {
- return $this;
- }
-
- /**
- * @return Boolean Indicating whether or not this component is a DataSource
- */
- function isDataSource() {
- return TRUE;
- }
-
-}
-?>
\ No newline at end of file
Modified: 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/OutputExpression.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/OutputExpression.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/OutputExpression.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -2,7 +2,7 @@
/**
* Outputs the result of an expression like {$var} or {$'var'}
*/
-class OutputExpression extends CompilerComponent
+class OutputExpression extends CompileTreeNode
{
protected $expression;
Modified: 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/PHPNode.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/PHPNode.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/PHPNode.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -1,5 +1,5 @@
<?php
-class PHPNode extends CompilerComponent
+class PHPNode extends CompileTreeNode
{
protected $contents;
Modified: 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/TextNode.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/TextNode.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/TextNode.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -1,5 +1,5 @@
<?php
-class TextNode extends CompilerComponent
+class TextNode extends CompileTreeNode
{
protected $contents;
Modified: 3.x/packages/wact/trunk/framework/template/compiler/parser/SourceFileParser.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/parser/SourceFileParser.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/framework/template/compiler/parser/SourceFileParser.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -111,10 +111,10 @@
/**
* Used to parse the source template.
* Initially invoked by the CompileTemplate function,
- * the first component argument being a CompilerTreeRootNode.
+ * the first component argument being a CompileTreeRootNode.
* Uses the TagDictionary to spot compiler components
* @see CompileTemplate
- * @see CompilerTreeRootNode
+ * @see CompileTreeRootNode
* @param object compile time component
* @return void
* @access protected
Modified: 3.x/packages/wact/trunk/framework/template/compiler/parser/WactNodeBuilder.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/parser/WactNodeBuilder.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/framework/template/compiler/parser/WactNodeBuilder.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -56,7 +56,7 @@
* @param string XML tag name of component
* @param array attributes for tag
* @param boolean whether the tag has contents
- * @return CompilerComponent
+ * @return CompileTreeNode
* @access public
*/
function buildTagNode($TagInfo, $tag, $attrs, $isEmpty)
@@ -186,7 +186,7 @@
/**
* Creates a compound attribute
- * @param CompilerComponent component to which the attribute belongs
+ * @param CompileTreeNode component to which the attribute belongs
* @param string name
* @param string value
* @return CompoundAttribute
Modified: 3.x/packages/wact/trunk/framework/template/compiler/parser/WactTreeBuilder.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/parser/WactTreeBuilder.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/framework/template/compiler/parser/WactTreeBuilder.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -1,6 +1,6 @@
<?php
/**
-* Acts on the CompilerTreeRootNode in response to events within the SourceFileParser
+* Acts on the CompileTreeRootNode in response to events within the SourceFileParser
*
* When adding an open tag to the tree, call pushExpectedTag(). When closing
* a tag, call popExpectedTag(), which ensures the tree is balanced.
@@ -17,7 +17,7 @@
{
/**
* Current Component
- * @var CompilerComponent
+ * @var CompileTreeNode
* @access private
*/
var $component;
@@ -48,7 +48,7 @@
/**
* Returns the current component
- * @return CompilerComponent
+ * @return CompileTreeNode
* @access public
*/
function &getCursor() {
@@ -57,7 +57,7 @@
/**
* Sets the cursor (the current working component) of the tree builder
- * @param CompilerComponent
+ * @param CompileTreeNode
* @return void
* @access public
*/
@@ -70,7 +70,7 @@
* Adds a component to the tree, then makes that component the 'cursor'.
* Return the result of the component's preParse() method which is the
* parsing instruction PARSER_FORBID_PARSING or PARSER_REQUIRE_PARSING.
- * @param CompilerComponent
+ * @param CompileTreeNode
* @return void
* @access public
*/
@@ -88,7 +88,7 @@
/**
* Adds a component to the tree, without descending into it.
* This begins and finishes the component's composition
- * @param CompilerComponent
+ * @param CompileTreeNode
* @return void
* @access public
*/
@@ -142,7 +142,7 @@
* Sets the cursor to a new position, and pushes the old cursor onto the
* expected tags stack.
* @see popExpectedTag
- * @param CompilerComponent
+ * @param CompileTreeNode
* @return void
* @access public
*/
@@ -223,7 +223,7 @@
* Checks that each immediate child of the current component has a unique ID
* amongst its siblings.
* @see popNode
- * @param object CompilerComponent
+ * @param object CompileTreeNode
* @return void
*/
function checkServerIds() {
Modified: 3.x/packages/wact/trunk/framework/template/compiler/tags/CompilerTag.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tags/CompilerTag.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tags/CompilerTag.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -1,5 +1,5 @@
<?php
-class CompilerTag extends CompilerComponent
+class CompilerTag extends CompileTreeNode
{
/**
* Sets the XML attributes for this component (as extracted from the
Modified: 3.x/packages/wact/trunk/framework/template/compiler/tags/SilentCompilerDirectiveTag.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tags/SilentCompilerDirectiveTag.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tags/SilentCompilerDirectiveTag.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -33,7 +33,7 @@
/**
* Results in all components registered as children of the instance of this
* component having their generate() methods called
- * @see CompilerComponent::generate
+ * @see CompileTreeNode::generate
* @param string code to generate
* @return void
* @access protected
Modified: 3.x/packages/wact/trunk/framework/template/compiler/templatecompiler.inc.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/templatecompiler.inc.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/framework/template/compiler/templatecompiler.inc.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -15,8 +15,8 @@
*/
require_once WACT_ROOT . '/template/compiler/WactDictionaryHolder.class.php';
-require_once WACT_ROOT . '/template/compiler/compile_tree_node/CompilerComponent.class.php';
-require_once WACT_ROOT . '/template/compiler/compile_tree_node/CompilerTreeRootNode.class.php';
+require_once WACT_ROOT . '/template/compiler/compile_tree_node/CompileTreeNode.class.php';
+require_once WACT_ROOT . '/template/compiler/compile_tree_node/CompileTreeRootNode.class.php';
require_once WACT_ROOT . '/template/compiler/compile_tree_node/TextNode.class.php';
require_once WACT_ROOT . '/template/compiler/compile_tree_node/PHPNode.class.php';
require_once WACT_ROOT . '/template/compiler/compile_tree_node/OutputExpression.class.php';
@@ -50,9 +50,9 @@
/**
* Creates a new ID for a server component, if one wasn't found. Called from
-* CompilerComponent::getServerId()
+* CompileTreeNode::getServerId()
* @see http://wact.sourceforge.net/index.php/getNewServerId
-* @see CompilerComponent
+* @see CompileTreeNode
* @return string id for server component e.g. id000(x)
* @access protected
*/
@@ -63,11 +63,11 @@
/**
* Compiles a template file. Uses the file scheme to location the source,
-* instantiates the CodeWriter and CompilerTreeRootNode (as the root) component then
+* instantiates the CodeWriter and CompileTreeRootNode (as the root) component then
* instantiates the SourceFileParser to parse the template.
* Creates the initialize and render functions in the compiled template.
* @see http://wact.sourceforge.net/CompileTemplateFile
-* @see CompilerTreeRootNode
+* @see CompileTreeRootNode
* @see CodeWriter
* @see SourceFileParser
* @param string name of source template
@@ -87,7 +87,7 @@
$code =& new CodeWriter();
$code->setFunctionPrefix(md5($destfile));
- $Tree =& GetCompilerTreeRootNode(TRUE);
+ $Tree =& GetCompileTreeRootNode(TRUE);
$Tree->SourceLocation =& new WactSourceLocation($sourcefile, '');
$TreeBuilder =& new WactTreeBuilder;
@@ -113,17 +113,17 @@
}
/**
-* Used to maintain a single instance of CompilerTreeRootNode for a single
+* Used to maintain a single instance of CompileTreeRootNode for a single
* template file.
* Called from CompileTemplateFile and WactTreeBuilder::checkServerId()
* @param boolean (default = FALSE) whether to create a new instance
-* @return CompilerTreeRootNode
+* @return CompileTreeRootNode
* @access public
*/
-function & GetCompilerTreeRootNode($newInstance = FALSE) {
+function & GetCompileTreeRootNode($newInstance = FALSE) {
static $Tree = NULL;
if ( $newInstance || is_null($Tree) ) {
- $Tree = new CompilerTreeRootNode();
+ $Tree = new CompileTreeRootNode();
}
return $Tree;
}
Modified: 3.x/packages/wact/trunk/framework/template/components/data/data_table.inc.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/components/data/data_table.inc.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/framework/template/components/data/data_table.inc.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -268,7 +268,7 @@
* @package WACT_COMPONENT
* @author Jason E. Sweat <jsweat_php AT yahoo DOT com>
*/
-class DataColumnComponent extends CompilerComponent {
+class DataColumnComponent extends CompileTreeNode {
/**
* @var boolean controls auto row grouping feature
*/
Modified: 3.x/packages/wact/trunk/framework/template/tags/form/inputautocomplete.tag.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/tags/form/inputautocomplete.tag.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/framework/template/tags/form/inputautocomplete.tag.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -119,12 +119,12 @@
}
}
EOD;
- $CompilerTreeRootNode = & $this->findParentByClass('CompilerTreeRootNode') ;
- if ( !$CompilerTreeRootNode ) {
+ $CompileTreeRootNode = & $this->findParentByClass('CompileTreeRootNode') ;
+ if ( !$CompileTreeRootNode ) {
$this->raiseCompilerError('COMPONENTNOTFOUND',
- array('ServerId' => 'CompilerTreeRootNode'));
+ array('ServerId' => 'CompileTreeRootNode'));
}
- $JContainer = & $CompilerTreeRootNode->findChildByClass('CoreScriptTag');
+ $JContainer = & $CompileTreeRootNode->findChildByClass('CoreScriptTag');
if ( !$JContainer ) {
$this->raiseCompilerError('COMPONENTNOTFOUND',
array('ServerId' => 'CoreScriptTag'));
Copied: 3.x/packages/wact/trunk/tests/cases/template/compiler/CompileTreeNodeTest.class.php (from rev 4162, 3.x/packages/wact/trunk/tests/cases/template/compiler/CompilerComponentTest.class.php)
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/CompileTreeNodeTest.class.php (rev 0)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/CompileTreeNodeTest.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -0,0 +1,143 @@
+<?php
+require_once WACT_ROOT . '/template/template.inc.php';
+require_once WACT_ROOT . '/template/compiler/templatecompiler.inc.php';
+
+Mock::generate('CompileTreeNode', 'MockCompileTreeNode');
+Mock::generate('CodeWriter', 'MockCodeWriter');
+
+class CompileTreeNodeTest extends UnitTestCase {
+
+ function setUp() {
+ $this->component = new CompileTreeNode();
+ }
+
+ function tearDown() {
+ unset ( $this->component );
+ }
+
+ function testGetServerIdAttribute() {
+ $this->component->ServerId = 'Test';
+ $this->assertEqual($this->component->getServerId(), 'Test');
+ }
+
+ function testGetServerIdGenerated() {
+ $id = $this->component->getServerId();
+ $this->assertEqual($this->component->getServerId(), $id);
+ }
+
+ function testFindChild() {
+ $mock = new MockCompileTreeNode();
+ $mock->setReturnValue('getServerId', 'Test');
+ $this->component->addChild($mock);
+ $this->assertIsA($this->component->findChild('Test'), 'MockCompileTreeNode');
+ }
+
+ function testFindChildNotFound() {
+ $this->assertFalse($this->component->findChild('Test'));
+ }
+
+ function testFindChildByClass() {
+ $mock = new MockCompileTreeNode();
+ $this->component->addChild($mock);
+ $this->assertIsA($this->component->findChildByClass('MockCompileTreeNode'), 'MockCompileTreeNode');
+ }
+
+ function testFindChildByClassNotFound() {
+ $this->assertFalse($this->component->findChildByClass('MockCompileTreeNode'));
+ }
+
+ function testFindParentByChilld() {
+ $parent = new CompileTreeNode();
+ $parent->addChild($this->component);
+ $this->assertIsA($this->component->findParentByClass('CompileTreeNode'), 'CompileTreeNode');
+ }
+
+ function testFindParentByClassNotFound() {
+ $this->assertFalse($this->component->findParentByClass('Test'));
+ }
+
+ function testRemoveChild() {
+ $mock = new MockCompileTreeNode();
+ $mock->setReturnValue('getServerId', 'Test');
+ $this->component->addChild($mock);
+ $this->assertIsA($this->component->removeChild('Test'), 'MockCompileTreeNode');
+ }
+
+ function testGetChildren() {
+ $mock =& new MockCompileTreeNode();
+ $this->component->addChild($mock);
+ $children = $this->component->getChildren();
+ $this->assertReference($mock, $children[0]);
+ }
+
+ function testPrepare() {
+ $child = new MockCompileTreeNode();
+ $this->component->addChild($child);
+ $child->expectCallCount('prepare', 1);
+ $this->component->prepare();
+ }
+
+ function testPreParse() {
+ $this->assertEqual($this->component->preParse(), PARSER_REQUIRE_PARSING);
+ }
+
+ function testGetDataSource() {
+ $parent =& new MockCompileTreeNode();
+ $ds = new WactArrayObject();
+ $parent->setReturnValue('getDataSource', $ds);
+ $this->component->parent = & $parent;
+ $this->assertIsA($this->component->getDataSource(), 'WactArrayObject');
+ }
+
+ function testGetParentDataSource() {
+ /* This test case is broken
+ $parent = &new MockCompileTreeNode($this);
+ $ds = new WactArrayObject();
+ $testparent = new MockCompileTreeNode($this);
+ $testparent->expectCallCount('getDataSource', 1);
+ $mockds->parent = & $testparent;
+ $parent->setReturnValue('getDataSource', $ds);
+ $this->component->parent = & $parent;
+ */
+ }
+
+ function testGetRootDataSource() {
+ $parent =&new MockCompileTreeNode();
+ $parent->parent = NULL;
+ $this->component->parent = $parent;
+ $this->assertIsA($this->component->getRootDataSource(), 'MockCompileTreeNode');
+ }
+
+ function testgetDataSourceRefCode() {
+ $parent = &new MockCompileTreeNode();
+ $parent->setReturnValue('getDataSourceRefCode', 'Test');
+ $this->component->parent = & $parent;
+ $this->assertEqual($this->component->getDataSourceRefCode(), 'Test');
+ }
+
+ function testGenerateConstructor() {
+ $code = new MockCodeWriter();
+ $child = new MockCompileTreeNode();
+ $child->expectCallCount('generateConstructor', 1);
+ $this->component->addChild($child);
+ $this->component->generateConstructor($code);
+ }
+
+ function testGenerateContents() {
+ $code = new MockCodeWriter();
+ $child = new MockCompileTreeNode();
+ $child->expectCallCount('generate', 1);
+ $this->component->addChild($child);
+ $this->component->generateContents($code);
+ }
+
+ function testGenerate(){
+ $code = new MockCodeWriter();
+ $child = new MockCompileTreeNode();
+ $child->expectCallCount('generate', 1);
+ $this->component->addChild($child);
+ $this->component->generate($code);
+ }
+}
+
+?>
\ No newline at end of file
Deleted: 3.x/packages/wact/trunk/tests/cases/template/compiler/CompilerComponentTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/CompilerComponentTest.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/CompilerComponentTest.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -1,143 +0,0 @@
-<?php
-require_once WACT_ROOT . '/template/template.inc.php';
-require_once WACT_ROOT . '/template/compiler/templatecompiler.inc.php';
-
-Mock::generate('CompilerComponent', 'MockCompilerComponent');
-Mock::generate('CodeWriter', 'MockCodeWriter');
-
-class CompilerComponentTest extends UnitTestCase {
-
- function setUp() {
- $this->component = & new CompilerComponent();
- }
-
- function tearDown() {
- unset ( $this->component );
- }
-
- function testGetServerIdAttribute() {
- $this->component->ServerId = 'Test';
- $this->assertEqual($this->component->getServerId(), 'Test');
- }
-
- function testGetServerIdGenerated() {
- $id = $this->component->getServerId();
- $this->assertEqual($this->component->getServerId(), $id);
- }
-
- function testFindChild() {
- $mock = & new MockCompilerComponent($this);
- $mock->setReturnValue('getServerId', 'Test');
- $this->component->addChild($mock);
- $this->assertIsA($this->component->findChild('Test'), 'MockCompilerComponent');
- }
-
- function testFindChildNotFound() {
- $this->assertFalse($this->component->findChild('Test'));
- }
-
- function testFindChildByClass() {
- $mock = & new MockCompilerComponent($this);
- $this->component->addChild($mock);
- $this->assertIsA($this->component->findChildByClass('MockCompilerComponent'), 'MockCompilerComponent');
- }
-
- function testFindChildByClassNotFound() {
- $this->assertFalse($this->component->findChildByClass('MockCompilerComponent'));
- }
-
- function testFindParentByChilld() {
- $parent = & new CompilerComponent();
- $parent->addChild($this->component);
- $this->assertIsA($this->component->findParentByClass('CompilerComponent'), 'CompilerComponent');
- }
-
- function testFindParentByClassNotFound() {
- $this->assertFalse($this->component->findParentByClass('Test'));
- }
-
- function testRemoveChild() {
- $mock = & new MockCompilerComponent($this);
- $mock->setReturnValue('getServerId', 'Test');
- $this->component->addChild($mock);
- $this->assertIsA($this->component->removeChild('Test'), 'MockCompilerComponent');
- }
-
- function testGetChildren() {
- $mock =& new MockCompilerComponent($this);
- $this->component->addChild($mock);
- $children = $this->component->getChildren();
- $this->assertReference($mock, $children[0]);
- }
-
- function testPrepare() {
- $child = new MockCompilerComponent();
- $this->component->addChild($child);
- $child->expectCallCount('prepare', 1);
- $this->component->prepare();
- }
-
- function testPreParse() {
- $this->assertEqual($this->component->preParse(), PARSER_REQUIRE_PARSING);
- }
-
- function testGetDataSource() {
- $parent =& new MockCompilerComponent($this);
- $ds = new WactArrayObject();
- $parent->setReturnValue('getDataSource', $ds);
- $this->component->parent = & $parent;
- $this->assertIsA($this->component->getDataSource(), 'WactArrayObject');
- }
-
- function testGetParentDataSource() {
- /* This test case is broken
- $parent = &new MockCompilerComponent($this);
- $ds = & new WactArrayObject();
- $testparent = & new MockCompilerComponent($this);
- $testparent->expectCallCount('getDataSource', 1);
- $mockds->parent = & $testparent;
- $parent->setReturnValue('getDataSource', $ds);
- $this->component->parent = & $parent;
- */
- }
-
- function testGetRootDataSource() {
- $parent =&new MockCompilerComponent($this);
- $parent->parent = NULL;
- $this->component->parent = $parent;
- $this->assertIsA($this->component->getRootDataSource(), 'MockCompilerComponent');
- }
-
- function testgetDataSourceRefCode() {
- $parent = &new MockCompilerComponent($this);
- $parent->setReturnValue('getDataSourceRefCode', 'Test');
- $this->component->parent = & $parent;
- $this->assertEqual($this->component->getDataSourceRefCode(), 'Test');
- }
-
- function testGenerateConstructor() {
- $code = new MockCodeWriter();
- $child = new MockCompilerComponent();
- $child->expectCallCount('generateConstructor', 1);
- $this->component->addChild($child);
- $this->component->generateConstructor($code);
- }
-
- function testGenerateContents() {
- $code = new MockCodeWriter();
- $child = new MockCompilerComponent();
- $child->expectCallCount('generate', 1);
- $this->component->addChild($child);
- $this->component->generateContents($code);
- }
-
- function testGenerate(){
- $code = new MockCodeWriter();
- $child = new MockCompilerComponent($this);
- $child->expectCallCount('generate', 1);
- $this->component->addChild($child);
- $this->component->generate($code);
- }
-}
-
-?>
\ No newline at end of file
Copied: 3.x/packages/wact/trunk/tests/cases/template/compiler/CompilerTreeRootNodeTest.class.php (from rev 4163, 3.x/packages/wact/trunk/tests/cases/template/compiler/ComponentTreeTest.class.php)
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/CompilerTreeRootNodeTest.class.php (rev 0)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/CompilerTreeRootNodeTest.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -0,0 +1,24 @@
+<?php
+require_once(WACT_TEST_CASES . '/template/compiler/CompileTreeNodeTest.class.php');
+
+class CompileTreeRootNodeTest extends CompileTreeNodeTest
+{
+ function testGetDataSourceRefCode()
+ {
+ $this->component = new CompileTreeRootNode();
+ $this->assertEqual($this->component->getDataSourceRefCode(), '$root->_datasource');
+ }
+
+ function testGetComponentRefCode()
+ {
+ $this->component = new CompileTreeRootNode();
+ $this->assertEqual($this->component->getComponentRefCode(), '$root');
+ }
+
+ function testGetDataSource()
+ {
+ $this->component = new CompileTreeRootNode();
+ $this->assertIsA($this->component->getDataSource(), 'CompileTreeRootNode');
+ }
+}
+?>
\ No newline at end of file
Deleted: 3.x/packages/wact/trunk/tests/cases/template/compiler/ComponentTreeTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/ComponentTreeTest.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/ComponentTreeTest.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -1,24 +0,0 @@
-<?php
-require_once(WACT_TEST_CASES . '/template/compiler/CompilerComponentTest.class.php');
-
-class CompilerTreeRootNodeTest extends CompilerComponentTest
-{
- function testGetDataSourceRefCode()
- {
- $this->component = new CompilerTreeRootNode();
- $this->assertEqual($this->component->getDataSourceRefCode(), '$root->_datasource');
- }
-
- function testGetComponentRefCode()
- {
- $this->component = new CompilerTreeRootNode();
- $this->assertEqual($this->component->getComponentRefCode(), '$root');
- }
-
- function testGetDataSource()
- {
- $this->component = new CompilerTreeRootNode();
- $this->assertIsA($this->component->getDataSource(), 'CompilerTreeRootNode');
- }
-}
-?>
\ No newline at end of file
Modified: 3.x/packages/wact/trunk/tests/cases/template/compiler/PHPNodeTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/PHPNodeTest.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/PHPNodeTest.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -1,7 +1,7 @@
<?php
-require_once WACT_TEST_CASES . '/template/compiler/CompilerComponentTest.class.php';
+require_once WACT_TEST_CASES . '/template/compiler/CompileTreeNodeTest.class.php';
-class PHPNodeTest extends CompilerComponentTest {
+class PHPNodeTest extends CompileTreeNodeTest {
function setUp() {
$this->component = & new PHPNode('test');
}
Modified: 3.x/packages/wact/trunk/tests/cases/template/compiler/TextNodeTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/TextNodeTest.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/TextNodeTest.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -1,7 +1,7 @@
<?php
-require_once(WACT_TEST_CASES . '/template/compiler/CompilerComponentTest.class.php');
+require_once(WACT_TEST_CASES . '/template/compiler/CompileTreeNodeTest.class.php');
-class TextNodeTest extends CompilerComponentTest
+class TextNodeTest extends CompileTreeNodeTest
{
function testGenerate()
{
Modified: 3.x/packages/wact/trunk/tests/cases/template/compiler/WactComponentParsingStateTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/WactComponentParsingStateTest.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/WactComponentParsingStateTest.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -136,7 +136,7 @@
function testEndElementNoMatch() {
$tree_builder =& new WactTreeBuilder();
- $Component =& new CompilerComponent();
+ $Component =& new CompileTreeNode();
$tree_builder->setCursor($Component);
$tree_builder->setDocumentLocator($this->state->Locator);
$tree_builder->pushExpectedTag('foo', PARSER_TAG_IS_COMPONENT);
Modified: 3.x/packages/wact/trunk/tests/cases/template/compiler/WactTreeBuilderTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/WactTreeBuilderTest.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/WactTreeBuilderTest.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -1,7 +1,7 @@
<?php
require_once WACT_ROOT . '/template/compiler/templatecompiler.inc.php';
-Mock::generate('CompilerComponent','MockCompilerComponent');
+Mock::generate('CompileTreeNode','MockCompileTreeNode');
Mock::generate('SourceFileParser','MockSourceFileParser');
Mock::generate('TextNode','MockTextNode');
Mock::generate('AttributeNode','MockAttributeNode');
@@ -13,7 +13,7 @@
function setUp()
{
$this->MockParser = new MockHTMLParser();
- $this->component = new MockCompilerComponent();
+ $this->component = new MockCompileTreeNode();
$this->tree_builder = new WactTreeBuilder();
$this->tree_builder->setCursor($this->component);
$this->tree_builder->setDocumentLocator($this->MockParser);
@@ -21,7 +21,7 @@
function testPushNode()
{
- $new_component = new MockCompilerComponent();
+ $new_component = new MockCompileTreeNode();
$this->component->expectOnce('addChild');
$new_component->expectOnce('preParse');
@@ -33,7 +33,7 @@
function testAddNode()
{
- $new_component = new MockCompilerComponent();
+ $new_component = new MockCompileTreeNode();
$this->component->expectOnce('addChild');
$new_component->expectOnce('preParse');
@@ -54,8 +54,8 @@
function testPopNode()
{
- $ParentComponent = new MockCompilerComponent();
- $GrandParentComponent = new MockCompilerComponent();
+ $ParentComponent = new MockCompileTreeNode();
+ $GrandParentComponent = new MockCompileTreeNode();
$ParentComponent->parent =& $GrandParentComponent;
$this->component->parent =& $ParentComponent;
@@ -103,10 +103,10 @@
// the cursor returns where it was before step (2)
// (5) New components added should appear under this orig point.
- $root = new CompilerComponent();
- $InsertionPoint = new CompilerComponent();
- $child1 = new CompilerComponent();
- $child2 = new CompilerComponent();
+ $root = new CompileTreeNode();
+ $InsertionPoint = new CompileTreeNode();
+ $child1 = new CompileTreeNode();
+ $child2 = new CompileTreeNode();
// set up an open tag at root
$this->tree_builder->setCursor($root);
@@ -144,7 +144,7 @@
function testPushAndPopExpectedTagsWithPushCursor()
{
- $new_cursor = new CompilerComponent();
+ $new_cursor = new CompileTreeNode();
$this->tree_builder->pushExpectedTag('tag1', 'tag1info');
@@ -171,12 +171,12 @@
function testCheckServerIdsOk()
{
- $root = new CompilerComponent();
- $child1 = new MockCompilerComponent();
+ $root = new CompileTreeNode();
+ $child1 = new MockCompileTreeNode();
$child1->setReturnValue('getChildren', array());
$child1->ServerId = 'id1';
- $child2 = new MockCompilerComponent();
+ $child2 = new MockCompileTreeNode();
$child2->setReturnValue('getChildren', array());
$child1->ServerId = 'id2';
$root->addChild($child1);
@@ -188,12 +188,12 @@
function testDuplicateServerIdsError()
{
- $root = new CompilerComponent();
- $child1 = new CompilerComponent();
+ $root = new CompileTreeNode();
+ $child1 = new CompileTreeNode();
$child1->ServerId = 'my_tag';
$root->addChild($child1);
- $child2 = new CompilerComponent();
+ $child2 = new CompileTreeNode();
$child2->ServerId = 'my_tag';
$root->addChild($child2);
@@ -211,16 +211,16 @@
function testDuplicateIdIsLegalInDifferentBranches()
{
- $root = new CompilerComponent();
+ $root = new CompileTreeNode();
- $Branch = new CompilerComponent();
+ $Branch = new CompileTreeNode();
$root->addChild($Branch);
- $child1 = new CompilerComponent();
+ $child1 = new CompileTreeNode();
$child1->ServerId = 'my_tag';
$Branch->addChild($child1);
- $child2 = new MockCompilerComponent();
+ $child2 = new MockCompileTreeNode();
$child1->ServerId = 'my_tag';
$root->addChild($child2);
Modified: 3.x/packages/wact/trunk/tests/cases/template/compiler/attribute/AttributeExpressionTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/attribute/AttributeExpressionTest.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/attribute/AttributeExpressionTest.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -6,7 +6,7 @@
{
function testIsConstant()
{
- $component = new CompilerComponent();
+ $component = new CompileTreeNode();
$attribute = new AttributeExpression('test', '"hello"', $component);
$this->assertTrue($attribute->isConstant());
@@ -14,7 +14,7 @@
function testGetValue()
{
- $component = new CompilerComponent();
+ $component = new CompileTreeNode();
$attribute = new AttributeExpression('test', '"hello"', $component);
$this->assertEqual($attribute->getValue(), 'hello');
@@ -22,7 +22,7 @@
function testGenerateConstantFragment()
{
- $component = new CompilerComponent();
+ $component = new CompileTreeNode();
$attribute = new AttributeExpression('test', '"hello"', $component);
$code_writer = new CodeWriter();
@@ -33,7 +33,7 @@
function testGenerateFragment()
{
- $component = new CompilerComponent();
+ $component = new CompileTreeNode();
$property = new CompilerProperty();
$component->registerProperty('hello', $property);
$attribute = new AttributeExpression('test', 'hello', $component);
@@ -45,7 +45,7 @@
function testGenerateForConstantValue()
{
- $component = new CompilerComponent();
+ $component = new CompileTreeNode();
$attribute = new AttributeExpression('test', '"<hello"', $component);
$code_writer = new CodeWriter();
@@ -55,7 +55,7 @@
function testGenerateForNonConstantValue()
{
- $component = new CompilerComponent();
+ $component = new CompileTreeNode();
$property = new CompilerProperty();
$component->registerProperty('hello', $property);
$attribute = new AttributeExpression('test', 'hello', $component);
@@ -69,7 +69,7 @@
{
$code_writer = new CodeWriter();
- $component = new CompilerComponent();
+ $component = new CompileTreeNode();
$property = new CompilerProperty();
$component->registerProperty('hello', $property);
$attribute = new AttributeExpression('test', 'hello', $component);
Modified: 3.x/packages/wact/trunk/tests/cases/template/compiler/expression/DataBindingExpressionTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/expression/DataBindingExpressionTest.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/expression/DataBindingExpressionTest.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -5,7 +5,7 @@
require_once WACT_ROOT . 'template/compiler/templatecompiler.inc.php';
-Mock::Generate('CompilerComponent', 'MockCompilerComponent');
+Mock::Generate('CompileTreeNode', 'MockCompileTreeNode');
Mock::Generate('CompilerProperty', 'MockCompilerProperty');
Mock::Generate('CodeWriter', 'MockCodeWriter');
@@ -13,10 +13,10 @@
{
function testAnalizeSimpleExpression()
{
- $dataspace = new MockCompilerComponent();
+ $dataspace = new MockCompileTreeNode();
$dataspace->setReturnValue('getProperty', NULL);
- $context = new MockCompilerComponent();
+ $context = new MockCompileTreeNode();
$context->setReturnReference('getDataSource', $dataspace);
$context->expectNever('getRootDataSource');
$context->expectNever('getParentDataSource');
@@ -28,10 +28,10 @@
function testAnalizeExpressionWithRootDatasourceSymbol()
{
- $root = new MockCompilerComponent();
+ $root = new MockCompileTreeNode();
$root->setReturnValue('getProperty', NULL);
- $context = new MockCompilerComponent();
+ $context = new MockCompileTreeNode();
$context->setReturnReference('getRootDataSource', $root);
$context->expectAtLeastOnce('getRootDataSource');
$context->expectNever('getDataSource');
@@ -44,10 +44,10 @@
function testAnalizeExpressionWithParentDatasourceSymbol()
{
- $parent = new MockCompilerComponent();
+ $parent = new MockCompileTreeNode();
$parent->setReturnValue('getProperty', NULL);
- $context = new MockCompilerComponent();
+ $context = new MockCompileTreeNode();
$context->setReturnReference('getParentDataSource', $parent);
$context->expectAtLeastOnce('getParentDataSource');
$context->expectNever('getRootDataSource');
@@ -62,9 +62,9 @@
{
$expression = '&$|%';
- $dataspace = new MockCompilerComponent();
+ $dataspace = new MockCompileTreeNode();
$dataspace->setReturnValue('getProperty', NULL);
- $context = new MockCompilerComponent();
+ $context = new MockCompileTreeNode();
$context->setReturnReference('getDataSource', $dataspace);
$context->expectOnce('raiseCompilerError',
array('BAD_BINDING', array('expression' => $expression)));
@@ -77,8 +77,8 @@
{
$expression = 'Test';
- $dataspace = new MockCompilerComponent();
- $context = new MockCompilerComponent();
+ $dataspace = new MockCompileTreeNode();
+ $context = new MockCompileTreeNode();
$context->setReturnReference('getDataSource', $dataspace);
$context->setReturnValue('getProperty', NULL);
$context->expectAtLeastOnce('getProperty', array('Test'));
@@ -97,8 +97,8 @@
$property->setReturnValue('IsConstant', TRUE);
$property->setReturnValue('getValue', 'hello');
- $dataspace = new MockCompilerComponent();
- $context = new MockCompilerComponent();
+ $dataspace = new MockCompileTreeNode();
+ $context = new MockCompileTreeNode();
$context->setReturnReference('getDataSource', $dataspace);
$context->setReturnReference('getProperty', $property);
$context->expectAtLeastOnce('getProperty', array('Test'));
@@ -110,9 +110,9 @@
function testIsConstant()
{
- $dataspace = new MockCompilerComponent();
+ $dataspace = new MockCompileTreeNode();
$dataspace->setReturnValue('getProperty', NULL);
- $context = new MockCompilerComponent();
+ $context = new MockCompileTreeNode();
$context->setReturnReference('getDataSource', $dataspace);
$DBE = new DataBindingExpression('Test', $context);
@@ -126,9 +126,9 @@
$property->expectAtLeastOnce('IsConstant');
$property->setReturnValue('IsConstant', TRUE);
- $dataspace = new MockCompilerComponent();
+ $dataspace = new MockCompileTreeNode();
- $context = new MockCompilerComponent();
+ $context = new MockCompileTreeNode();
$context->setReturnReference('getDataSource', $dataspace);
$context->setReturnReference('getProperty', $property);
$context->expectAtLeastOnce('getProperty', array('Test'));
@@ -144,9 +144,9 @@
$property = new MockCompilerProperty();
$property->expectAtLeastOnce('generatePreStatement');
- $dataspace = new MockCompilerComponent();
+ $dataspace = new MockCompileTreeNode();
- $context = new MockCompilerComponent();
+ $context = new MockCompileTreeNode();
$context->setReturnReference('getDataSource', $dataspace);
$context->setReturnReference('getProperty', $property);
$context->expectAtLeastOnce('getProperty', array('Test'));
@@ -160,8 +160,8 @@
$codewriter = new MockCodeWriter();
$property = new MockCompilerProperty();
$property->expectAtLeastOnce('generatePostStatement');
- $dataspace = new MockCompilerComponent();
- $context = new MockCompilerComponent();
+ $dataspace = new MockCompileTreeNode();
+ $context = new MockCompileTreeNode();
$context->setReturnReference('getDataSource', $dataspace);
$context->setReturnReference('getProperty', $property);
@@ -176,8 +176,8 @@
$codewriter = new MockCodeWriter();
$property = new MockCompilerProperty();
$property->expectAtLeastOnce('generateExpression');
- $dataspace = new MockCompilerComponent();
- $context = new MockCompilerComponent();
+ $dataspace = new MockCompileTreeNode();
+ $context = new MockCompileTreeNode();
$context->setReturnReference('getDataSource', $dataspace);
$context->setReturnReference('getProperty', $property);
@@ -191,9 +191,9 @@
{
$codewriter = new MockCodeWriter();
$codewriter->expectAtLeastOnce('writePHP');
- $dataspace = new MockCompilerComponent();
+ $dataspace = new MockCompileTreeNode();
$dataspace->setReturnValue('getProperty', NULL);
- $context = new MockCompilerComponent();
+ $context = new MockCompileTreeNode();
$context->setReturnReference('getDataSource', $dataspace);
$DBE = new DataBindingExpression('Test', $context);
Modified: 3.x/packages/wact/trunk/tests/cases/template/compiler/expression/ExpressionTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/expression/ExpressionTest.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/expression/ExpressionTest.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -77,53 +77,53 @@
function testCreateValueInteger()
{
- $expression = new Expression('29', new CompilerComponent());
+ $expression = new Expression('29', new CompileTreeNode());
$this->assertTrue($expression->isConstant());
$this->assertEqual($expression->getValue(), 29);
}
function testCreateValueFloat()
{
- $expression = new Expression('1.5', new CompilerComponent());
+ $expression = new Expression('1.5', new CompileTreeNode());
$this->assertTrue($expression->isConstant());
$this->assertEqual($expression->getValue(), 1.5);
}
function testCreateValueNegInteger()
{
- $expression = new Expression('-29', new CompilerComponent());
+ $expression = new Expression('-29', new CompileTreeNode());
$this->assertTrue($expression->isConstant());
$this->assertEqual($expression->getValue(), -29);
}
function testCreateValueNegFloat()
{
- $expression = new Expression('-1.5', new CompilerComponent());
+ $expression = new Expression('-1.5', new CompileTreeNode());
$this->assertTrue($expression->isConstant());
$this->assertEqual($expression->getValue(), -1.5);
}
function testCreateValueSingleString()
{
- $expression = new Expression("'hello'", new CompilerComponent());
+ $expression = new Expression("'hello'", new CompileTreeNode());
$this->assertTrue($expression->isConstant());
$this->assertEqual($expression->getValue(), 'hello');
}
function testCreateValueDoubleString()
{
- $expression = new Expression('"hello"', new CompilerComponent());
+ $expression = new Expression('"hello"', new CompileTreeNode());
$this->assertTrue($expression->isConstant());
$this->assertEqual($expression->getValue(), 'hello');
}
function testMissingFilter()
{
- $context = new CompilerComponent();
+ $context = new CompileTreeNode();
try
{
- $expression = new Expression('Test|no_such_filter', new CompilerComponent());
+ $expression = new Expression('Test|no_such_filter', new CompileTreeNode());
$this->assertTrue(false);
}
catch(WactException $e)
@@ -137,7 +137,7 @@
{
try
{
- $expression = new Expression('Test|99', new CompilerComponent());
+ $expression = new Expression('Test|99', new CompileTreeNode());
$this->assertTrue(false);
}
catch(WactException $e)
@@ -149,19 +149,19 @@
function testIsConstant()
{
- $expression = new Expression('"Test"', new CompilerComponent());
+ $expression = new Expression('"Test"', new CompileTreeNode());
$this->assertTrue($expression->isConstant());
}
function testGetValueForConstant()
{
- $expression = new Expression('"Test"', new CompilerComponent());
+ $expression = new Expression('"Test"', new CompileTreeNode());
$this->assertEqual($expression->getValue(), 'Test');
}
function testGetValueForDBE()
{
- $context = new CompilerComponent();
+ $context = new CompileTreeNode();
$property = new ConstantProperty('hello');
$context->registerProperty('Test', $property);
@@ -173,7 +173,7 @@
{
$code_writer = new CodeWriter();
- $expression = new Expression('"Test"|expression_testing_filter', new CompilerComponent());
+ $expression = new Expression('"Test"|expression_testing_filter', new CompileTreeNode());
$expression->generatePreStatement($code_writer);
$expression->generateExpression($code_writer);
$expression->generatePostStatement($code_writer);
@@ -187,28 +187,28 @@
function testApplyDefaultFilter()
{
- $expression = new Expression('"Test"', new CompilerComponent(), 'expression_testing_filter');
+ $expression = new Expression('"Test"', new CompileTreeNode(), 'expression_testing_filter');
$expression->prepare();
$this->assertEqual(ExpressionTestingFilter :: $calls['prepare'], 1);
}
function testDontApplyDefaultFilter()
{
- $expression = new Expression('"Test"|raw', new CompilerComponent(), 'expression_testing_filter');
+ $expression = new Expression('"Test"|raw', new CompileTreeNode(), 'expression_testing_filter');
$expression->prepare();
$this->assertEqual(ExpressionTestingFilter :: $calls['prepare'], 0);
}
function testDontApplyDefaultFilter2()
{
- $expression = new Expression('"Test"|expression_testing_filter|raw', new CompilerComponent(), 'expression_testing_filter');
+ $expression = new Expression('"Test"|expression_testing_filter|raw', new CompileTreeNode(), 'expression_testing_filter');
$expression->prepare();
$this->assertEqual(ExpressionTestingFilter :: $calls['prepare'], 1);
}
function testDontApplyDefaultFilterIsTheSameFilterIsTheLastAmongExpressionFilters()
{
- $expression = new Expression('"Test"|expression_testing_filter', new CompilerComponent(), 'expression_testing_filter');
+ $expression = new Expression('"Test"|expression_testing_filter', new CompileTreeNode(), 'expression_testing_filter');
$expression->prepare();
$this->assertEqual(ExpressionTestingFilter :: $calls['prepare'], 1);
}
@@ -218,7 +218,7 @@
$filter_info = new FilterInfo('expression_testing_filter', 'ExpressionTestingFilter');
WactDictionaryHolder :: registerFilter($filter_info, __FILE__, 0, 3);
- $expression = new Expression('"Test"|expression_testing_filter', new CompilerComponent(), 'expression_testing_filter');
+ $expression = new Expression('"Test"|expression_testing_filter', new CompileTreeNode(), 'expression_testing_filter');
$expression->prepare();
$this->assertEqual(ExpressionTestingFilter :: $calls['prepare'], 1);
}
Modified: 3.x/packages/wact/trunk/tests/cases/template/compiler/tags/CompilerDirectiveTagTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/tags/CompilerDirectiveTagTest.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/tags/CompilerDirectiveTagTest.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -3,9 +3,9 @@
* @package WACT_TESTS
* @version $Id: CompilerDirectiveTagTest.class.php 2864 2006-02-28 10:20:41Z pachanga $
*/
-require_once WACT_TEST_CASES . '/template/compiler/CompilerComponentTest.class.php';
+require_once WACT_TEST_CASES . '/template/compiler/CompileTreeNodeTest.class.php';
-class CompilerDirectiveTagTest extends CompilerComponentTest {
+class CompilerDirectiveTagTest extends CompileTreeNodeTest {
/* Avoid re-tests for time being, as static value in memory ... */
function testGetServerIdNew() {
Modified: 3.x/packages/wact/trunk/tests/cases/template/compiler/tags/CompilerTagTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/tags/CompilerTagTest.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/tags/CompilerTagTest.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -1,7 +1,7 @@
<?php
-require_once WACT_TEST_CASES . '/template/compiler/CompilerComponentTest.class.php';
+require_once WACT_TEST_CASES . '/template/compiler/CompileTreeNodeTest.class.php';
-class CompilerTagTest extends CompilerComponentTest
+class CompilerTagTest extends CompileTreeNodeTest
{
function setUp() {
$this->component = & new CompilerTag();
Modified: 3.x/packages/wact/trunk/tests/cases/template/compiler/tags/ServerComponentTagTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/tags/ServerComponentTagTest.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/tags/ServerComponentTagTest.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -27,7 +27,7 @@
}
function testGetComponentRefCode() {
- $Mock = & new MockCompilerComponent($this);
+ $Mock = & new MockCompileTreeNode($this);
$Mock->setReturnValue('getComponentRefCode','$DataSpace');
$this->component->parent = & $Mock;
$this->assertEqual($this->component->getComponentRefCode(),'$DataSpace->children[\'id001\']');
@@ -48,7 +48,7 @@
$this->component->runtimeComponentName = 'testname';
$MockCode = new CodeWriterTestVersion();
$MockCode->expectOnce('registerInclude', array('testinclude.inc.php'));
- $MockParent = new MockCompilerComponent();
+ $MockParent = new MockCompileTreeNode();
$MockParent->setReturnValue('getComponentRefCode','$DataSpace');
$this->component->parent = $MockParent;
$this->component->generateConstructor($MockCode);
Modified: 3.x/packages/wact/trunk/tests/cases/template/compiler/tags/ServerTagComponentTagTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/tags/ServerTagComponentTagTest.class.php 2006-10-16 07:21:57 UTC (rev 4163)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/tags/ServerTagComponentTagTest.class.php 2006-10-16 07:28:34 UTC (rev 4164)
@@ -19,7 +19,7 @@
$this->component->hasClosingTag = TRUE;
$this->component->TagInfo =& new TagInfo('test', 'testclass');
- $MockParent = new MockCompilerComponent();
+ $MockParent = new MockCompileTreeNode();
$MockParent->setReturnValue('getComponentRefCode','$DataSpace');
$this->component->parent = & $MockParent;
More information about the limb-svn
mailing list