[limb-svn] r4166 - in 3.x/packages/wact/trunk: framework/template/compiler framework/template/compiler/tag_node tests/cases/template/compiler tests/cases/template/compiler/compile_tree_node tests/cases/template/compiler/parser tests/cases/template/compiler/tag_node
svn at limb-project.com
svn at limb-project.com
Mon Oct 16 11:37:58 MSD 2006
Author: serega
Date: 2006-10-16 11:37:58 +0400 (Mon, 16 Oct 2006)
New Revision: 4166
Added:
3.x/packages/wact/trunk/framework/template/compiler/tag_node/
3.x/packages/wact/trunk/framework/template/compiler/tag_node/CompilerDirectiveTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/CompilerTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/GenericContainerTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/GenericTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerComponentTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerDataComponentTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerTagComponentTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/SilentCompilerDirectiveTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/WactTagInfoExtractor.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/tagdictionary.inc.php
3.x/packages/wact/trunk/tests/cases/template/compiler/compile_tree_node/
3.x/packages/wact/trunk/tests/cases/template/compiler/compile_tree_node/CompileTreeNodeTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/compile_tree_node/CompileTreeRootNodeTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/compile_tree_node/PHPNodeTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/compile_tree_node/TextNodeTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/parser/
3.x/packages/wact/trunk/tests/cases/template/compiler/parser/HtmlParserMalformedTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/parser/HtmlParserTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/parser/HtmlParserTruncatedTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/parser/SourceFileParserTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/parser/WactBaseParsingStateTestCase.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/parser/WactComponentParsingStateTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/parser/WactLiteralParsingStateTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/parser/WactTreeBuilderTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tag_node/
3.x/packages/wact/trunk/tests/cases/template/compiler/tag_node/CompilerDirectiveTagTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tag_node/CompilerTagTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tag_node/ServerComponentTagTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tag_node/ServerTagComponentTagTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tag_node/SilentCompilerDirectiveTagTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tag_node/TagDictionaryTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tag_node/WactDictionaryHolderTest.class.php
Removed:
3.x/packages/wact/trunk/framework/template/compiler/tag_node/CompilerDirectiveTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/CompilerTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/GenericContainerTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/GenericTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerComponentTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerDataComponentTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerTagComponentTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/SilentCompilerDirectiveTag.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/WactTagInfoExtractor.class.php
3.x/packages/wact/trunk/framework/template/compiler/tag_node/tagdictionary.inc.php
3.x/packages/wact/trunk/framework/template/compiler/tags/
3.x/packages/wact/trunk/tests/cases/template/compiler/CompileTreeNodeTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/CompileTreeRootNodeTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/HtmlParserMalformedTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/HtmlParserTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/HtmlParserTruncatedTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/PHPNodeTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/SourceFileParserTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/TextNodeTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/WactBaseParsingStateTestCase.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/WactComponentParsingStateTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/WactLiteralParsingStateTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/WactTreeBuilderTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tag_node/CompilerDirectiveTagTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tag_node/CompilerTagTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tag_node/ServerComponentTagTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tag_node/ServerTagComponentTagTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tag_node/SilentCompilerDirectiveTagTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tag_node/TagDictionaryTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tag_node/WactDictionaryHolderTest.class.php
3.x/packages/wact/trunk/tests/cases/template/compiler/tags/
Modified:
3.x/packages/wact/trunk/framework/template/compiler/WactDictionaryHolder.class.php
3.x/packages/wact/trunk/framework/template/compiler/templatecompiler.inc.php
Log:
-- -- WACT package clean up and refactoring
Modified: 3.x/packages/wact/trunk/framework/template/compiler/WactDictionaryHolder.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/WactDictionaryHolder.class.php 2006-10-16 07:29:40 UTC (rev 4165)
+++ 3.x/packages/wact/trunk/framework/template/compiler/WactDictionaryHolder.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -58,7 +58,7 @@
function initializeTagDictionary()
{
- require_once WACT_ROOT . '/template/compiler/tags/tagdictionary.inc.php';
+ require_once WACT_ROOT . '/template/compiler/tag_node/tagdictionary.inc.php';
$this->_initializeDictionary('tag', 'TagDictionary', 'tag');
}
Copied: 3.x/packages/wact/trunk/framework/template/compiler/tag_node (from rev 4162, 3.x/packages/wact/trunk/framework/template/compiler/tags)
Deleted: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/CompilerDirectiveTag.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tags/CompilerDirectiveTag.class.php 2006-10-16 06:51:26 UTC (rev 4162)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/CompilerDirectiveTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,21 +0,0 @@
-<?php
-//--------------------------------------------------------------------------------
-// Copyright 2003 Procata, Inc.
-// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
-//--------------------------------------------------------------------------------
-/**
-* @package WACT_TEMPLATE
-* @version $Id: CompilerDirectiveTag.class.php,v 1.4 2003/09/23 14:37:44 harryf Exp $
-*/
-//--------------------------------------------------------------------------------
-/**
-* Compiler directive tags do not have a corresponding runtime server Component,
-* but they do render their contents into the compiled template.
-* @see http://wact.sourceforge.net/index.php/CompilerDirectiveTag
-* @access public
-* @abstract
-* @package WACT_TEMPLATE
-*/
-class CompilerDirectiveTag extends CompilerTag {
-}
-?>
\ No newline at end of file
Copied: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/CompilerDirectiveTag.class.php (from rev 4165, 3.x/packages/wact/trunk/framework/template/compiler/tags/CompilerDirectiveTag.class.php)
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tag_node/CompilerDirectiveTag.class.php (rev 0)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/CompilerDirectiveTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -0,0 +1,21 @@
+<?php
+//--------------------------------------------------------------------------------
+// Copyright 2003 Procata, Inc.
+// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
+//--------------------------------------------------------------------------------
+/**
+* @package WACT_TEMPLATE
+* @version $Id: CompilerDirectiveTag.class.php,v 1.4 2003/09/23 14:37:44 harryf Exp $
+*/
+//--------------------------------------------------------------------------------
+/**
+* Compiler directive tags do not have a corresponding runtime server Component,
+* but they do render their contents into the compiled template.
+* @see http://wact.sourceforge.net/index.php/CompilerDirectiveTag
+* @access public
+* @abstract
+* @package WACT_TEMPLATE
+*/
+class CompilerDirectiveTag extends CompilerTag {
+}
+?>
\ No newline at end of file
Deleted: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/CompilerTag.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tags/CompilerTag.class.php 2006-10-16 06:51:26 UTC (rev 4162)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/CompilerTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,149 +0,0 @@
-<?php
-class CompilerTag extends CompilerComponent
-{
- /**
- * Sets the XML attributes for this component (as extracted from the
- * template)
- * @param object XML attributes
- * @return void
- * @access protected
- */
- function addChildAttribute(&$child) {
- $attrib = strtolower($child->getName());
- if (isset($this->attributeNodes[$attrib])) {
- $this->raiseCompilerError('DUPLICATEATTRIBUTE',
- array('attribute' => $attrib));
- }
- $this->attributeNodes[$attrib] =& $child;
- }
-
- /**
- * Sets an attribute
- * @param string name of attribute
- * @param string value of attribute
- * @return void
- * @access public
- */
- function setAttribute($attrib, $value) {
- $Component =& new AttributeNode($attrib, $value);
- $this->addChildAttribute($Component);
- }
-
- /**
- * Returns the value of an XML attribute (as extracted from template) or
- * NULL if attribute not found
- * @param string attribute name
- * @return mixed string attribute value or null
- * @access public
- */
- function getAttribute($attrib) {
- if ( isset($this->attributeNodes[strtolower($attrib)]) ) {
- return $this->attributeNodes[strtolower($attrib)]->getValue();
- }
- }
-
- /**
- * Check to see whether a named attribute exists
- * @param string name of attribute
- * @return boolean
- * @access public
- */
- function hasAttribute($attrib) {
- return isset($this->attributeNodes[strtolower($attrib)]);
- }
-
- /**
- * Return the value of a boolean attribute as a boolean.
- * ATTRIBUTE=ANYTHING (true)
- * ATTRIBUTE=(FALSE|N|NA|NO|NONE|0) (false)
- * ATTRIBUTE (true)
- * (attribute unspecified) (default)
- * @param string attribute name
- * @param boolean value to return if attribute is not found
- * @return boolean
- * @access public
- */
- function getBoolAttribute($attrib, $default = FALSE) {
- if ( isset($this->attributeNodes[strtolower($attrib)]) ) {
- switch (strtoupper($this->attributeNodes[strtolower($attrib)]->getValue())) {
- case 'FALSE':
- case 'N':
- case 'NO':
- case 'NONE':
- case 'NA':
- case '0':
- return false;
- default:
- return true;
- }
- } else {
- return $default;
- }
- }
-
- /**
- * Remove an attribute from the list
- * @param string name of attribute
- * @return void
- * @access public
- */
- function removeAttribute($attrib) {
- unset($this->attributeNodes[strtolower($attrib)]);
- }
-
- /**
- * Returns an array containing the attributes of this component that
- * can be resolved at compile time.
- * @return array representation of attributes
- * @access protected
- */
- function getAttributesAsArray($suppress = array()) {
- $suppress = array_map('strtolower', $suppress);
- $attributes = array();
- foreach( array_keys($this->attributeNodes) as $key) {
- if (!in_array($key, $suppress) && $this->attributeNodes[$key]->isConstant()) {
- $attributes[$this->attributeNodes[$key]->getName()] = $this->getAttribute($key);
- }
- }
- return $attributes;
- }
-
- function generateAttributeList(&$code, $suppress = array()) {
- $suppress = array_map('strtolower', $suppress);
- foreach( array_keys($this->attributeNodes) as $key) {
- if (!in_array($key, $suppress)) {
- $this->attributeNodes[$key]->generate($code);
- }
- }
- }
-
- function generateDynamicAttributeList(&$code, $suppress = array()) {
- $suppress = array_map('strtolower', $suppress);
- foreach( array_keys($this->attributeNodes) as $key) {
- if (!in_array($key, $suppress) && !$this->attributeNodes[$key]->isConstant()) {
- $this->attributeNodes[$key]->generate($code);
- }
- }
- }
-
- function getServerId() {
- if ($this->hasAttribute('wact:id'))
- return $this->getAttribute('wact:id');
- elseif($this->hasAttribute('id'))
- return $this->getAttribute('id');
- else
- return parent :: getServerId();
- }
-
- /**
- * Get the value of the XML id attribute
- * @return string value of id attribute
- * @access protected
- */
- function getClientId() {
- if ( $this->hasAttribute('id') ) {
- return $this->getAttribute('id');
- }
- }
-}
-?>
\ No newline at end of file
Copied: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/CompilerTag.class.php (from rev 4165, 3.x/packages/wact/trunk/framework/template/compiler/tags/CompilerTag.class.php)
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tag_node/CompilerTag.class.php (rev 0)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/CompilerTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -0,0 +1,149 @@
+<?php
+class CompilerTag extends CompileTreeNode
+{
+ /**
+ * Sets the XML attributes for this component (as extracted from the
+ * template)
+ * @param object XML attributes
+ * @return void
+ * @access protected
+ */
+ function addChildAttribute(&$child) {
+ $attrib = strtolower($child->getName());
+ if (isset($this->attributeNodes[$attrib])) {
+ $this->raiseCompilerError('DUPLICATEATTRIBUTE',
+ array('attribute' => $attrib));
+ }
+ $this->attributeNodes[$attrib] =& $child;
+ }
+
+ /**
+ * Sets an attribute
+ * @param string name of attribute
+ * @param string value of attribute
+ * @return void
+ * @access public
+ */
+ function setAttribute($attrib, $value) {
+ $Component =& new AttributeNode($attrib, $value);
+ $this->addChildAttribute($Component);
+ }
+
+ /**
+ * Returns the value of an XML attribute (as extracted from template) or
+ * NULL if attribute not found
+ * @param string attribute name
+ * @return mixed string attribute value or null
+ * @access public
+ */
+ function getAttribute($attrib) {
+ if ( isset($this->attributeNodes[strtolower($attrib)]) ) {
+ return $this->attributeNodes[strtolower($attrib)]->getValue();
+ }
+ }
+
+ /**
+ * Check to see whether a named attribute exists
+ * @param string name of attribute
+ * @return boolean
+ * @access public
+ */
+ function hasAttribute($attrib) {
+ return isset($this->attributeNodes[strtolower($attrib)]);
+ }
+
+ /**
+ * Return the value of a boolean attribute as a boolean.
+ * ATTRIBUTE=ANYTHING (true)
+ * ATTRIBUTE=(FALSE|N|NA|NO|NONE|0) (false)
+ * ATTRIBUTE (true)
+ * (attribute unspecified) (default)
+ * @param string attribute name
+ * @param boolean value to return if attribute is not found
+ * @return boolean
+ * @access public
+ */
+ function getBoolAttribute($attrib, $default = FALSE) {
+ if ( isset($this->attributeNodes[strtolower($attrib)]) ) {
+ switch (strtoupper($this->attributeNodes[strtolower($attrib)]->getValue())) {
+ case 'FALSE':
+ case 'N':
+ case 'NO':
+ case 'NONE':
+ case 'NA':
+ case '0':
+ return false;
+ default:
+ return true;
+ }
+ } else {
+ return $default;
+ }
+ }
+
+ /**
+ * Remove an attribute from the list
+ * @param string name of attribute
+ * @return void
+ * @access public
+ */
+ function removeAttribute($attrib) {
+ unset($this->attributeNodes[strtolower($attrib)]);
+ }
+
+ /**
+ * Returns an array containing the attributes of this component that
+ * can be resolved at compile time.
+ * @return array representation of attributes
+ * @access protected
+ */
+ function getAttributesAsArray($suppress = array()) {
+ $suppress = array_map('strtolower', $suppress);
+ $attributes = array();
+ foreach( array_keys($this->attributeNodes) as $key) {
+ if (!in_array($key, $suppress) && $this->attributeNodes[$key]->isConstant()) {
+ $attributes[$this->attributeNodes[$key]->getName()] = $this->getAttribute($key);
+ }
+ }
+ return $attributes;
+ }
+
+ function generateAttributeList(&$code, $suppress = array()) {
+ $suppress = array_map('strtolower', $suppress);
+ foreach( array_keys($this->attributeNodes) as $key) {
+ if (!in_array($key, $suppress)) {
+ $this->attributeNodes[$key]->generate($code);
+ }
+ }
+ }
+
+ function generateDynamicAttributeList(&$code, $suppress = array()) {
+ $suppress = array_map('strtolower', $suppress);
+ foreach( array_keys($this->attributeNodes) as $key) {
+ if (!in_array($key, $suppress) && !$this->attributeNodes[$key]->isConstant()) {
+ $this->attributeNodes[$key]->generate($code);
+ }
+ }
+ }
+
+ function getServerId() {
+ if ($this->hasAttribute('wact:id'))
+ return $this->getAttribute('wact:id');
+ elseif($this->hasAttribute('id'))
+ return $this->getAttribute('id');
+ else
+ return parent :: getServerId();
+ }
+
+ /**
+ * Get the value of the XML id attribute
+ * @return string value of id attribute
+ * @access protected
+ */
+ function getClientId() {
+ if ( $this->hasAttribute('id') ) {
+ return $this->getAttribute('id');
+ }
+ }
+}
+?>
\ No newline at end of file
Deleted: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/GenericContainerTag.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tags/GenericContainerTag.class.php 2006-10-16 06:51:26 UTC (rev 4162)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/GenericContainerTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,38 +0,0 @@
-<?php
-
-class GenericContainerTag extends ServerTagComponentTag {
- /**
- * File to include at runtime
- * @var string path to runtime component relative to WACT_ROOT
- * @access private
- */
- var $runtimeIncludeFile;
- /**
- * Name of runtime component class
- * @var string
- * @access private
- */
- var $runtimeComponentName = 'TagComponent';
- /**
- * @param CodeWriter
- * @return void
- * @access protected
- */
- function generateConstructor(&$code) {
- parent::generateConstructor($code);
- $code->writePHP($this->getComponentRefCode() .
- '->IsDynamicallyRendered = TRUE;');
- }
- /**
- * @param CodeWriter
- * @return void
- * @access protected
- */
- function postGenerate(& $code) {
- $code->writePHP($this->getComponentRefCode() . '->render();');
- parent::postGenerate($code);
- }
-}
-
-?>
-
Copied: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/GenericContainerTag.class.php (from rev 4165, 3.x/packages/wact/trunk/framework/template/compiler/tags/GenericContainerTag.class.php)
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tag_node/GenericContainerTag.class.php (rev 0)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/GenericContainerTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -0,0 +1,38 @@
+<?php
+
+class GenericContainerTag extends ServerTagComponentTag {
+ /**
+ * File to include at runtime
+ * @var string path to runtime component relative to WACT_ROOT
+ * @access private
+ */
+ var $runtimeIncludeFile;
+ /**
+ * Name of runtime component class
+ * @var string
+ * @access private
+ */
+ var $runtimeComponentName = 'TagComponent';
+ /**
+ * @param CodeWriter
+ * @return void
+ * @access protected
+ */
+ function generateConstructor(&$code) {
+ parent::generateConstructor($code);
+ $code->writePHP($this->getComponentRefCode() .
+ '->IsDynamicallyRendered = TRUE;');
+ }
+ /**
+ * @param CodeWriter
+ * @return void
+ * @access protected
+ */
+ function postGenerate(& $code) {
+ $code->writePHP($this->getComponentRefCode() . '->render();');
+ parent::postGenerate($code);
+ }
+}
+
+?>
+
Deleted: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/GenericTag.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tags/GenericTag.class.php 2006-10-16 06:51:26 UTC (rev 4162)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/GenericTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,35 +0,0 @@
-<?php
-//--------------------------------------------------------------------------------
-// Copyright 2003 Procata, Inc.
-// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
-//--------------------------------------------------------------------------------
-/**
-* @package WACT_TEMPLATE
-* @version $Id: generictag.inc.php,v 1.2 2004/03/15 12:35:08 harryf Exp $
-*/
-//--------------------------------------------------------------------------------
-/**
-* Compile time component for tags in template which are not
-* recognized WACT tags but have a runat="server" attribute.
-* This allows native HTML tags, for example, to be manipulated
-* at runtime.
-* GenericTag is for tags which no children.
-* @see http://wact.sourceforge.net/index.php/GenericTag
-* @access protected
-* @package WACT_TEMPLATE
-*/
-class GenericTag extends ServerTagComponentTag {
- /**
- * File to include at runtime
- * @var string path to runtime component relative to WACT_ROOT
- * @access private
- */
- var $runtimeIncludeFile;
- /**
- * Name of runtime component class
- * @var string
- * @access private
- */
- var $runtimeComponentName = 'TagComponent';
-}
-?>
\ No newline at end of file
Copied: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/GenericTag.class.php (from rev 4165, 3.x/packages/wact/trunk/framework/template/compiler/tags/GenericTag.class.php)
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tag_node/GenericTag.class.php (rev 0)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/GenericTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -0,0 +1,35 @@
+<?php
+//--------------------------------------------------------------------------------
+// Copyright 2003 Procata, Inc.
+// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
+//--------------------------------------------------------------------------------
+/**
+* @package WACT_TEMPLATE
+* @version $Id: generictag.inc.php,v 1.2 2004/03/15 12:35:08 harryf Exp $
+*/
+//--------------------------------------------------------------------------------
+/**
+* Compile time component for tags in template which are not
+* recognized WACT tags but have a runat="server" attribute.
+* This allows native HTML tags, for example, to be manipulated
+* at runtime.
+* GenericTag is for tags which no children.
+* @see http://wact.sourceforge.net/index.php/GenericTag
+* @access protected
+* @package WACT_TEMPLATE
+*/
+class GenericTag extends ServerTagComponentTag {
+ /**
+ * File to include at runtime
+ * @var string path to runtime component relative to WACT_ROOT
+ * @access private
+ */
+ var $runtimeIncludeFile;
+ /**
+ * Name of runtime component class
+ * @var string
+ * @access private
+ */
+ var $runtimeComponentName = 'TagComponent';
+}
+?>
\ No newline at end of file
Deleted: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerComponentTag.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tags/ServerComponentTag.class.php 2006-10-16 06:51:26 UTC (rev 4162)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerComponentTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,53 +0,0 @@
-<?php
-//--------------------------------------------------------------------------------
-// Copyright 2003 Procata, Inc.
-// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
-//--------------------------------------------------------------------------------
-/**
-* @package WACT_TEMPLATE
-* @version $Id: servercomponent.inc.php,v 1.14 2005/10/24 09:09:25 ian_w_white Exp $
-*/
-//--------------------------------------------------------------------------------
-/**
-* include parent class
-*/
-require_once WACT_ROOT . '/template/compiler/CompilerComponent.class.php';
-/**
-* Server component tags have a corresponding server Component which represents
-* an API which can be used to manipulate the marked up portion of the template.
-* @see http://wact.sourceforge.net/index.php/ServerComponentTag
-* @access public
-* @abstract
-* @package WACT_TEMPLATE
-*/
-class ServerComponentTag extends CompilerTag {
- /**
- * Returns a string of PHP code identifying the component in the hierarchy.
- * @return string
- * @access protected
- */
- function getComponentRefCode() {
- $path = $this->parent->getComponentRefCode();
- return $path . '->children[\'' . $this->getServerId() . '\']';
- }
-
- /**
- * Calls the parent getComponentRefCode() method and writes it to the
- * compiled template, appending an addChild() method used to create
- * this component at runtime
- * @param CodeWriter
- * @return string
- * @access protected
- */
- function generateConstructor(&$code) {
- if (isset($this->runtimeIncludeFile)) {
- $code->registerInclude($this->runtimeIncludeFile);
- }
-
- $code->writePHP($this->parent->getComponentRefCode() .
- '->addChild(new ' . $this->runtimeComponentName .
- '(), \'' . $this->getServerId() . '\');' . "\n");
- parent::generateConstructor($code);
- }
-}
-?>
\ No newline at end of file
Copied: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerComponentTag.class.php (from rev 4165, 3.x/packages/wact/trunk/framework/template/compiler/tags/ServerComponentTag.class.php)
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerComponentTag.class.php (rev 0)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerComponentTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -0,0 +1,53 @@
+<?php
+//--------------------------------------------------------------------------------
+// Copyright 2003 Procata, Inc.
+// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
+//--------------------------------------------------------------------------------
+/**
+* @package WACT_TEMPLATE
+* @version $Id: servercomponent.inc.php,v 1.14 2005/10/24 09:09:25 ian_w_white Exp $
+*/
+//--------------------------------------------------------------------------------
+/**
+* include parent class
+*/
+require_once WACT_ROOT . '/template/compiler/tag_node/CompilerTag.class.php';
+/**
+* Server component tags have a corresponding server Component which represents
+* an API which can be used to manipulate the marked up portion of the template.
+* @see http://wact.sourceforge.net/index.php/ServerComponentTag
+* @access public
+* @abstract
+* @package WACT_TEMPLATE
+*/
+class ServerComponentTag extends CompilerTag {
+ /**
+ * Returns a string of PHP code identifying the component in the hierarchy.
+ * @return string
+ * @access protected
+ */
+ function getComponentRefCode() {
+ $path = $this->parent->getComponentRefCode();
+ return $path . '->children[\'' . $this->getServerId() . '\']';
+ }
+
+ /**
+ * Calls the parent getComponentRefCode() method and writes it to the
+ * compiled template, appending an addChild() method used to create
+ * this component at runtime
+ * @param CodeWriter
+ * @return string
+ * @access protected
+ */
+ function generateConstructor(&$code) {
+ if (isset($this->runtimeIncludeFile)) {
+ $code->registerInclude($this->runtimeIncludeFile);
+ }
+
+ $code->writePHP($this->parent->getComponentRefCode() .
+ '->addChild(new ' . $this->runtimeComponentName .
+ '(), \'' . $this->getServerId() . '\');' . "\n");
+ parent::generateConstructor($code);
+ }
+}
+?>
\ No newline at end of file
Deleted: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerDataComponentTag.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tags/ServerDataComponentTag.class.php 2006-10-16 06:51:26 UTC (rev 4162)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerDataComponentTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,67 +0,0 @@
-<?php
-//--------------------------------------------------------------------------------
-// Copyright 2003 Procata, Inc.
-// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
-//--------------------------------------------------------------------------------
-/**
-* @package WACT_TEMPLATE
-* @version $Id: ServerDataComponentTag.class.php,v 1.18 2005/10/24 09:09:25 ian_w_white Exp $
-*/
-//--------------------------------------------------------------------------------
-/**
-* include parent class
-*/
-require_once WACT_ROOT . '/template/compiler/tags/ServerComponentTag.class.php';
-/**
-* Server tag component tags are ServerComponentTags which also correspond to
-* an HTML tag. Makes it easier to implement instead of extending from the
-* ServerComponentTag class
-* @see http://wact.sourceforge.net/index.php/ServerTagComponentTag
-* @access public
-* @abstract
-* @package WACT_TEMPLATE
-*/
-class ServerDataComponentTag extends ServerComponentTag {
-
- var $DataSourceReferenceVariable;
-
- function preGenerate(&$code)
- {
- parent::preGenerate($code);
-
- if ($this->hasAttribute('from'))
- $this->generateDereference($code, $this->getAttribute('from'));
- }
-
- function generateDereference(&$code, $from)
- {
- $code->writePHP($this->getComponentRefCode() . '->registerDataSource(');
- $parent_datasource =& $this->getParentDataSource();
- $code->writePHP('Template::makeObject(' . $parent_datasource->getDataSourceRefCode() . ',');
- $code->writePHPLIteral($from);
- $code->writePHP('));');
- }
-
- function &getDataSource()
- {
- return $this;
- }
-
- /**
- * @return string PHP runtime variable reference to component
- * @access protected
- */
- function getDataSourceRefCode() {
- return $this->getComponentRefCode() . '->_datasource';
- // return '$' . $this->DataSourceReferenceVariable;
- }
-
- /**
- * @return Boolean Indicating whether or not this component is a DataSource
- */
- function isDataSource() {
- return TRUE;
- }
-
-}
-?>
\ No newline at end of file
Copied: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerDataComponentTag.class.php (from rev 4165, 3.x/packages/wact/trunk/framework/template/compiler/tags/ServerDataComponentTag.class.php)
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerDataComponentTag.class.php (rev 0)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerDataComponentTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -0,0 +1,67 @@
+<?php
+//--------------------------------------------------------------------------------
+// Copyright 2003 Procata, Inc.
+// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
+//--------------------------------------------------------------------------------
+/**
+* @package WACT_TEMPLATE
+* @version $Id: ServerDataComponentTag.class.php,v 1.18 2005/10/24 09:09:25 ian_w_white Exp $
+*/
+//--------------------------------------------------------------------------------
+/**
+* include parent class
+*/
+require_once WACT_ROOT . '/template/compiler/tag_node/ServerComponentTag.class.php';
+/**
+* Server tag component tags are ServerComponentTags which also correspond to
+* an HTML tag. Makes it easier to implement instead of extending from the
+* ServerComponentTag class
+* @see http://wact.sourceforge.net/index.php/ServerTagComponentTag
+* @access public
+* @abstract
+* @package WACT_TEMPLATE
+*/
+class ServerDataComponentTag extends ServerComponentTag {
+
+ var $DataSourceReferenceVariable;
+
+ function preGenerate(&$code)
+ {
+ parent::preGenerate($code);
+
+ if ($this->hasAttribute('from'))
+ $this->generateDereference($code, $this->getAttribute('from'));
+ }
+
+ function generateDereference(&$code, $from)
+ {
+ $code->writePHP($this->getComponentRefCode() . '->registerDataSource(');
+ $parent_datasource =& $this->getParentDataSource();
+ $code->writePHP('Template::makeObject(' . $parent_datasource->getDataSourceRefCode() . ',');
+ $code->writePHPLIteral($from);
+ $code->writePHP('));');
+ }
+
+ function &getDataSource()
+ {
+ return $this;
+ }
+
+ /**
+ * @return string PHP runtime variable reference to component
+ * @access protected
+ */
+ function getDataSourceRefCode() {
+ return $this->getComponentRefCode() . '->_datasource';
+ // return '$' . $this->DataSourceReferenceVariable;
+ }
+
+ /**
+ * @return Boolean Indicating whether or not this component is a DataSource
+ */
+ function isDataSource() {
+ return TRUE;
+ }
+
+}
+?>
\ No newline at end of file
Deleted: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerTagComponentTag.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tags/ServerTagComponentTag.class.php 2006-10-16 06:51:26 UTC (rev 4162)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerTagComponentTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,99 +0,0 @@
-<?php
-//--------------------------------------------------------------------------------
-// Copyright 2003 Procata, Inc.
-// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
-//--------------------------------------------------------------------------------
-/**
-* @package WACT_TEMPLATE
-* @version $Id: ServerTagComponentTag.class.php,v 1.22 2005/11/02 16:11:17 ian_w_white Exp $
-*/
-//--------------------------------------------------------------------------------
-/**
-* Server tag component tags are ServerComponentTags which also correspond to
-* an HTML tag. Makes it easier to implement instead of extending from the
-* ServerComponentTag class
-* @see http://wact.sourceforge.net/index.php/ServerTagComponentTag
-* @access public
-* @abstract
-* @package WACT_TEMPLATE
-*/
-class ServerTagComponentTag extends ServerComponentTag {
-
- /**
- * Returns the XML tag name
- * @return string
- * @access protected
- */
- function getRenderedTag() {
- return $this->tag;
- }
-
- /**
- * Adds any additional XML attributes
- * @param CodeWriter
- * @return void
- * @abstract
- * @access protected
- */
- function generateExtraAttributes(&$code) {
- $this->generateDynamicAttributeList($code);
- }
-
- /**
- * Calls the parent preGenerate() method then writes the XML tag name
- * plus a PHP string which renders the attributes from the runtime
- * component.
- * @param CodeWriter
- * @return void
- * @access protected
- * @todo compiler needs to detect XML to allow for empty tags
- */
- function preGenerate(&$code) {
- parent::preGenerate($code);
- $code->writeHTML('<' . $this->getRenderedTag());
- $code->writePHP($this->getComponentRefCode() . '->renderAttributes();');
- if ( $this->emptyClosedTag ) {
- $code->writeHTML(' /');
- }
- $this->generateExtraAttributes($code);
- $code->writeHTML('>');
- }
-
- /**
- * Writes the closing tag string to the compiled template
- * @param CodeWriter
- * @return void
- * @access protected
- */
- function postGenerate(&$code) {
- if ($this->hasClosingTag) {
- $code->writeHTML('</' . $this->getRenderedTag() . '>');
- }
- parent::postGenerate($code);
- }
-
- /**
- * Writes the compiled template constructor from the runtime component,
- * assigning the attributes found at compile time to the runtime component
- * via a serialized string
- * @param CodeWriter
- * @return void
- * @access protected
- */
- function generateConstructor(&$code) {
- parent::generateConstructor($code);
-
- // Determine which attributes should not propigate to runtime
- $CompileTimeAttributes = $this->TagInfo->CompilerAttributes;
-
- // Add the runat attribute to the list of attributes to filter out
- $CompileTimeAttributes[] = PARSER_TRIGGER_ATTR_NAME;
- $CompileTimeAttributes[] = 'wact:id';
-
- $code->writePHP($this->getComponentRefCode() . '->attributes = unserialize(');
- $code->writePHPLiteral(serialize($this->getAttributesAsArray($CompileTimeAttributes)));
- $code->writePHP(');');
-
- }
-}
-?>
\ No newline at end of file
Copied: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerTagComponentTag.class.php (from rev 4165, 3.x/packages/wact/trunk/framework/template/compiler/tags/ServerTagComponentTag.class.php)
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerTagComponentTag.class.php (rev 0)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/ServerTagComponentTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -0,0 +1,99 @@
+<?php
+//--------------------------------------------------------------------------------
+// Copyright 2003 Procata, Inc.
+// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
+//--------------------------------------------------------------------------------
+/**
+* @package WACT_TEMPLATE
+* @version $Id: ServerTagComponentTag.class.php,v 1.22 2005/11/02 16:11:17 ian_w_white Exp $
+*/
+//--------------------------------------------------------------------------------
+/**
+* Server tag component tags are ServerComponentTags which also correspond to
+* an HTML tag. Makes it easier to implement instead of extending from the
+* ServerComponentTag class
+* @see http://wact.sourceforge.net/index.php/ServerTagComponentTag
+* @access public
+* @abstract
+* @package WACT_TEMPLATE
+*/
+class ServerTagComponentTag extends ServerComponentTag {
+
+ /**
+ * Returns the XML tag name
+ * @return string
+ * @access protected
+ */
+ function getRenderedTag() {
+ return $this->tag;
+ }
+
+ /**
+ * Adds any additional XML attributes
+ * @param CodeWriter
+ * @return void
+ * @abstract
+ * @access protected
+ */
+ function generateExtraAttributes(&$code) {
+ $this->generateDynamicAttributeList($code);
+ }
+
+ /**
+ * Calls the parent preGenerate() method then writes the XML tag name
+ * plus a PHP string which renders the attributes from the runtime
+ * component.
+ * @param CodeWriter
+ * @return void
+ * @access protected
+ * @todo compiler needs to detect XML to allow for empty tags
+ */
+ function preGenerate(&$code) {
+ parent::preGenerate($code);
+ $code->writeHTML('<' . $this->getRenderedTag());
+ $code->writePHP($this->getComponentRefCode() . '->renderAttributes();');
+ if ( $this->emptyClosedTag ) {
+ $code->writeHTML(' /');
+ }
+ $this->generateExtraAttributes($code);
+ $code->writeHTML('>');
+ }
+
+ /**
+ * Writes the closing tag string to the compiled template
+ * @param CodeWriter
+ * @return void
+ * @access protected
+ */
+ function postGenerate(&$code) {
+ if ($this->hasClosingTag) {
+ $code->writeHTML('</' . $this->getRenderedTag() . '>');
+ }
+ parent::postGenerate($code);
+ }
+
+ /**
+ * Writes the compiled template constructor from the runtime component,
+ * assigning the attributes found at compile time to the runtime component
+ * via a serialized string
+ * @param CodeWriter
+ * @return void
+ * @access protected
+ */
+ function generateConstructor(&$code) {
+ parent::generateConstructor($code);
+
+ // Determine which attributes should not propigate to runtime
+ $CompileTimeAttributes = $this->TagInfo->CompilerAttributes;
+
+ // Add the runat attribute to the list of attributes to filter out
+ $CompileTimeAttributes[] = PARSER_TRIGGER_ATTR_NAME;
+ $CompileTimeAttributes[] = 'wact:id';
+
+ $code->writePHP($this->getComponentRefCode() . '->attributes = unserialize(');
+ $code->writePHPLiteral(serialize($this->getAttributesAsArray($CompileTimeAttributes)));
+ $code->writePHP(');');
+
+ }
+}
+?>
\ No newline at end of file
Deleted: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/SilentCompilerDirectiveTag.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tags/SilentCompilerDirectiveTag.class.php 2006-10-16 06:51:26 UTC (rev 4162)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/SilentCompilerDirectiveTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,45 +0,0 @@
-<?php
-//--------------------------------------------------------------------------------
-// Copyright 2003 Procata, Inc.
-// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
-//--------------------------------------------------------------------------------
-/**
-* @package WACT_TEMPLATE
-* @version $Id: silentCompilerDirectiveTag.class.php,v 1.5 2003/09/23 14:37:44 harryf Exp $
-*/
-//--------------------------------------------------------------------------------
-/**
-* Silent compiler directive tags are instructions for the compiler and do
-* not have a corresponding runtime Component, nor do they normally generate
-* output into the compiled template.
-* @see http://wact.sourceforge.net/index.php/SilentCompilerDirectiveTag
-* @access public
-* @abstract
-* @package WACT_TEMPLATE
-*/
-class SilentCompilerDirectiveTag extends CompilerTag {
- /**
- * Does nothing - SilentCompilerDirectiveTags do not generate
- * during construction of the compiled template
- * @param CodeWriter
- * @return void
- * @access protected
- */
- function generate(&$code) {
- // Silent Compiler Directives do not generate their contents during the
- // normal generation sequence.
- }
-
- /**
- * Results in all components registered as children of the instance of this
- * component having their generate() methods called
- * @see CompilerComponent::generate
- * @param string code to generate
- * @return void
- * @access protected
- */
- function generateNow(&$code) {
- return parent::generate($code);
- }
-}
-?>
\ No newline at end of file
Copied: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/SilentCompilerDirectiveTag.class.php (from rev 4165, 3.x/packages/wact/trunk/framework/template/compiler/tags/SilentCompilerDirectiveTag.class.php)
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tag_node/SilentCompilerDirectiveTag.class.php (rev 0)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/SilentCompilerDirectiveTag.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -0,0 +1,45 @@
+<?php
+//--------------------------------------------------------------------------------
+// Copyright 2003 Procata, Inc.
+// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
+//--------------------------------------------------------------------------------
+/**
+* @package WACT_TEMPLATE
+* @version $Id: silentCompilerDirectiveTag.class.php,v 1.5 2003/09/23 14:37:44 harryf Exp $
+*/
+//--------------------------------------------------------------------------------
+/**
+* Silent compiler directive tags are instructions for the compiler and do
+* not have a corresponding runtime Component, nor do they normally generate
+* output into the compiled template.
+* @see http://wact.sourceforge.net/index.php/SilentCompilerDirectiveTag
+* @access public
+* @abstract
+* @package WACT_TEMPLATE
+*/
+class SilentCompilerDirectiveTag extends CompilerTag {
+ /**
+ * Does nothing - SilentCompilerDirectiveTags do not generate
+ * during construction of the compiled template
+ * @param CodeWriter
+ * @return void
+ * @access protected
+ */
+ function generate(&$code) {
+ // Silent Compiler Directives do not generate their contents during the
+ // normal generation sequence.
+ }
+
+ /**
+ * Results in all components registered as children of the instance of this
+ * component having their generate() methods called
+ * @see CompileTreeNode::generate
+ * @param string code to generate
+ * @return void
+ * @access protected
+ */
+ function generateNow(&$code) {
+ return parent::generate($code);
+ }
+}
+?>
\ No newline at end of file
Deleted: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/WactTagInfoExtractor.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tags/WactTagInfoExtractor.class.php 2006-10-16 06:51:26 UTC (rev 4162)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/WactTagInfoExtractor.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,63 +0,0 @@
-<?php
-class WactTagInfoExtractor
-{
- var $dictionary;
- var $file;
- var $annotations = array();
-
- function __construct($dict, $file)
- {
- $this->dictionary = $dict;
- $this->file = $file;
- }
-
- function setCurrentFile($file)
- {
- $this->file = $file;
- }
-
- function annotation($name, $value)
- {
- $this->annotations[$name] = $value;
- }
-
- function beginClass($class, $parent_class)
- {
- $this->_validate();
-
- $info = new TagInfo($this->annotations['tag'], $class);
-
- if(isset($this->annotations['end_tag']))
- $info->setEndTag(constant($this->annotations['end_tag']));
-
- if(isset($this->annotations['attributes']))
- $this->_setCompillerAttributes($info, $this->annotations['attributes']);
-
- if(isset($this->annotations['known_parent']))
- $info->setKnownParent($this->annotations['known_parent']);
-
- if(isset($this->annotations['location']))
- $info->setDefaultLocation(constant($this->annotations['location']));
-
- $this->dictionary->registerTagInfo($info, $this->file);
- }
-
- function endClass()
- {
- $this->annotations = array();
- }
-
- function _setCompillerAttributes($info, $attributes_string)
- {
- $info->setCompilerAttributes(explode(' ', preg_replace('~\s+~', ' ', trim($attributes_string))));
- }
-
- function _validate()
- {
- if(!file_exists($this->file))
- throw new WactException('compiler', 'FILE_NOT_FOUND', array('file' => $this->file));
-
- if(!isset($this->annotations['tag']))
- throw new WactException('compiler', 'ANNOTATION_NOT_FOUND', array('annotation' => 'tag', 'file' => $this->file));
- }
-}
Copied: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/WactTagInfoExtractor.class.php (from rev 4165, 3.x/packages/wact/trunk/framework/template/compiler/tags/WactTagInfoExtractor.class.php)
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tag_node/WactTagInfoExtractor.class.php (rev 0)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/WactTagInfoExtractor.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -0,0 +1,63 @@
+<?php
+class WactTagInfoExtractor
+{
+ var $dictionary;
+ var $file;
+ var $annotations = array();
+
+ function __construct($dict, $file)
+ {
+ $this->dictionary = $dict;
+ $this->file = $file;
+ }
+
+ function setCurrentFile($file)
+ {
+ $this->file = $file;
+ }
+
+ function annotation($name, $value)
+ {
+ $this->annotations[$name] = $value;
+ }
+
+ function beginClass($class, $parent_class)
+ {
+ $this->_validate();
+
+ $info = new TagInfo($this->annotations['tag'], $class);
+
+ if(isset($this->annotations['end_tag']))
+ $info->setEndTag(constant($this->annotations['end_tag']));
+
+ if(isset($this->annotations['attributes']))
+ $this->_setCompillerAttributes($info, $this->annotations['attributes']);
+
+ if(isset($this->annotations['known_parent']))
+ $info->setKnownParent($this->annotations['known_parent']);
+
+ if(isset($this->annotations['location']))
+ $info->setDefaultLocation(constant($this->annotations['location']));
+
+ $this->dictionary->registerTagInfo($info, $this->file);
+ }
+
+ function endClass()
+ {
+ $this->annotations = array();
+ }
+
+ function _setCompillerAttributes($info, $attributes_string)
+ {
+ $info->setCompilerAttributes(explode(' ', preg_replace('~\s+~', ' ', trim($attributes_string))));
+ }
+
+ function _validate()
+ {
+ if(!file_exists($this->file))
+ throw new WactException('compiler', 'FILE_NOT_FOUND', array('file' => $this->file));
+
+ if(!isset($this->annotations['tag']))
+ throw new WactException('compiler', 'ANNOTATION_NOT_FOUND', array('annotation' => 'tag', 'file' => $this->file));
+ }
+}
Deleted: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/tagdictionary.inc.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tags/tagdictionary.inc.php 2006-10-16 06:51:26 UTC (rev 4162)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/tagdictionary.inc.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,172 +0,0 @@
-<?php
-//--------------------------------------------------------------------------------
-// Copyright 2003 Procata, Inc.
-// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
-//--------------------------------------------------------------------------------
-/**
-* @package WACT_TEMPLATE
-* @version $Id: tagdictionary.inc.php,v 1.24 2005/11/05 12:55:10 ian_w_white Exp $
-*/
-require_once WACT_ROOT . '/template/compiler/CompilerArtifactDictionary.class.php';
-
-/**
-* The tag must have a closing tag
-*/
-define('ENDTAG_REQUIRED', 1);
-/**
-* The tag may have a closing tag
-*/
-define('ENDTAG_OPTIONAL', 2);
-/**
-* The tag may not have a closing tag
-*/
-define('ENDTAG_FORBIDDEN', 3);
-
-
-define('LOCATION_SERVER', 'server');
-define('LOCATION_CLIENT', 'client');
-
-/**
-* Define the attribute which "triggers" components
-*/
-define('PARSER_TRIGGER_ATTR_NAME','runat'); // Must be lower case! See TreeBuilder::addAttributeNode
-define('PARSER_TRIGGER_ATTR_VALUE','server');
-
-/**
-* Define attribute for using known children
-* Referenced in ParserState::ComponentParsingState::open()
-*/
-define('PARSER_USEKNOWN_ATTR','useknown');
-
-/**
-* @package WACT_TEMPLATE
-*/
-class TagInfo {
- var $Tag = '';
- var $EndTag = ENDTAG_REQUIRED;
- var $TagClass = '';
- var $CompilerAttributes = array();
- var $KnownParent;
- var $DefaultLocation = LOCATION_SERVER;
- var $File;
-
- function TagInfo($tag, $class) {
- $this->Tag = $tag;
- $this->TagClass = $class;
- }
-
- function setEndTag($end) {
- $this->EndTag = $end;
- }
-
- function setCompilerAttributes($attributes) {
- $this->CompilerAttributes = $attributes;
- }
-
- function setKnownParent($parent) {
- $this->KnownParent = $parent;
- }
-
- function setDefaultLocation($location) {
- $this->DefaultLocation = $location;
- }
-
- function load() {
- if (!class_exists($this->TagClass) && isset($this->File)) {
- require_once $this->File;
- }
- }
-}
-
-class TagDictionary extends CompilerArtifactDictionary
-{
- var $TagInformation = array();
-
- function _createArtifactsExtractor($file)
- {
- require_once dirname(__FILE__) . '/WactTagInfoExtractor.class.php';
- return new WactTagInfoExtractor($this, $file);
- }
-
- function registerTagInfo($taginfo, $file)
- {
- $taginfo->File = $file;
- $this->TagInformation[strtolower($taginfo->Tag)] = $taginfo;
- }
-
- function getTagInfo($tag)
- {
- $tag = strtolower($tag);
- if (isset($this->TagInformation[$tag]))
- return $this->TagInformation[$tag];
- }
-
- /*
- * Determines whether a tag is a server component, examining attributes and class
- * Called from ComponentParsingState::open() only to check for components
- * @param string tag name
- * @param array tag attributes
- * @param boolean whether it's an empty tag for GenericTags
- * @return boolean TRUE if it's a component
- * @access private
- */
- function findComponent($tag, $attrs, $isEmpty, $Component) {
- $tag = strtolower($tag);
- // Does the tag have a wact:id attribute? if so, set 'runat = server'
- if ( isset ( $attrs['wact:id'] ) ) {
- $attrs[PARSER_TRIGGER_ATTR_NAME] = PARSER_TRIGGER_ATTR_VALUE;
- }
-
- // Does the tag have the runat attribute? If so it might be a component
- if ( isset ( $attrs[PARSER_TRIGGER_ATTR_NAME] ) ) {
-
- // Does runat ="server"? If so it's definately a component
- if ( strtolower($attrs[PARSER_TRIGGER_ATTR_NAME]) == PARSER_TRIGGER_ATTR_VALUE ) {
- if (isset($this->TagInformation[$tag])) {
- return $this->TagInformation[$tag];
- } else {
- // we are a generic tag. We run at the server, but have no
- // specific TagInfo record in the dictionary.
- if ( !$isEmpty ) {
- $generic =& new TagInfo($tag, 'GenericContainerTag');
- $generic->File = WACT_ROOT . '/template/compiler/generictag.inc.php';
-
- $generic->setEndTag(ENDTAG_REQUIRED);
- } else {
- $generic =& new TagInfo($tag, 'GenericTag');
- $generic->File = WACT_ROOT . '/template/compiler/generictag.inc.php';
- $generic->setEndTag(ENDTAG_FORBIDDEN);
- }
- $generic->setDefaultLocation(LOCATION_CLIENT);
-
- return $generic;
- }
- }
- } else if ( isset($this->TagInformation[$tag]) ) {
-
- $TagInfo =& $this->TagInformation[$tag];
-
- // DefaultLocation allows the location of some tags to be specified without
- // a corresponding runat="" attribute.
- if ($TagInfo->DefaultLocation == LOCATION_SERVER) {
- return $TagInfo;
- }
-
- //----------------------------------------------------------------------------
- // Is the tag a known child? This applies only to sub classes of
- // ServerTagComponentTag (tags that match HTML) and helps save adding
- // runat="server" excessively. The only tags at this time using this are
- // the form related tags.
- //----------------------------------------------------------------------------
- if ( isset($TagInfo->KnownParent) ) {
- if ( $KnownParent = & $Component->findSelfOrParentByClass($TagInfo->KnownParent) ) {
- if ( $KnownParent->getBoolAttribute('useknown',TRUE) ) {
- return $TagInfo;
- }
- }
- }
- }
- return NULL;
- }
-}
-?>
\ No newline at end of file
Copied: 3.x/packages/wact/trunk/framework/template/compiler/tag_node/tagdictionary.inc.php (from rev 4165, 3.x/packages/wact/trunk/framework/template/compiler/tags/tagdictionary.inc.php)
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/tag_node/tagdictionary.inc.php (rev 0)
+++ 3.x/packages/wact/trunk/framework/template/compiler/tag_node/tagdictionary.inc.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -0,0 +1,172 @@
+<?php
+//--------------------------------------------------------------------------------
+// Copyright 2003 Procata, Inc.
+// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
+//--------------------------------------------------------------------------------
+/**
+* @package WACT_TEMPLATE
+* @version $Id: tagdictionary.inc.php,v 1.24 2005/11/05 12:55:10 ian_w_white Exp $
+*/
+require_once WACT_ROOT . '/template/compiler/CompilerArtifactDictionary.class.php';
+
+/**
+* The tag must have a closing tag
+*/
+define('ENDTAG_REQUIRED', 1);
+/**
+* The tag may have a closing tag
+*/
+define('ENDTAG_OPTIONAL', 2);
+/**
+* The tag may not have a closing tag
+*/
+define('ENDTAG_FORBIDDEN', 3);
+
+
+define('LOCATION_SERVER', 'server');
+define('LOCATION_CLIENT', 'client');
+
+/**
+* Define the attribute which "triggers" components
+*/
+define('PARSER_TRIGGER_ATTR_NAME','runat'); // Must be lower case! See TreeBuilder::addAttributeNode
+define('PARSER_TRIGGER_ATTR_VALUE','server');
+
+/**
+* Define attribute for using known children
+* Referenced in ParserState::ComponentParsingState::open()
+*/
+define('PARSER_USEKNOWN_ATTR','useknown');
+
+/**
+* @package WACT_TEMPLATE
+*/
+class TagInfo {
+ var $Tag = '';
+ var $EndTag = ENDTAG_REQUIRED;
+ var $TagClass = '';
+ var $CompilerAttributes = array();
+ var $KnownParent;
+ var $DefaultLocation = LOCATION_SERVER;
+ var $File;
+
+ function TagInfo($tag, $class) {
+ $this->Tag = $tag;
+ $this->TagClass = $class;
+ }
+
+ function setEndTag($end) {
+ $this->EndTag = $end;
+ }
+
+ function setCompilerAttributes($attributes) {
+ $this->CompilerAttributes = $attributes;
+ }
+
+ function setKnownParent($parent) {
+ $this->KnownParent = $parent;
+ }
+
+ function setDefaultLocation($location) {
+ $this->DefaultLocation = $location;
+ }
+
+ function load() {
+ if (!class_exists($this->TagClass) && isset($this->File)) {
+ require_once $this->File;
+ }
+ }
+}
+
+class TagDictionary extends CompilerArtifactDictionary
+{
+ var $TagInformation = array();
+
+ function _createArtifactsExtractor($file)
+ {
+ require_once dirname(__FILE__) . '/WactTagInfoExtractor.class.php';
+ return new WactTagInfoExtractor($this, $file);
+ }
+
+ function registerTagInfo($taginfo, $file)
+ {
+ $taginfo->File = $file;
+ $this->TagInformation[strtolower($taginfo->Tag)] = $taginfo;
+ }
+
+ function getTagInfo($tag)
+ {
+ $tag = strtolower($tag);
+ if (isset($this->TagInformation[$tag]))
+ return $this->TagInformation[$tag];
+ }
+
+ /*
+ * Determines whether a tag is a server component, examining attributes and class
+ * Called from ComponentParsingState::open() only to check for components
+ * @param string tag name
+ * @param array tag attributes
+ * @param boolean whether it's an empty tag for GenericTags
+ * @return boolean TRUE if it's a component
+ * @access private
+ */
+ function findComponent($tag, $attrs, $isEmpty, $Component) {
+ $tag = strtolower($tag);
+ // Does the tag have a wact:id attribute? if so, set 'runat = server'
+ if ( isset ( $attrs['wact:id'] ) ) {
+ $attrs[PARSER_TRIGGER_ATTR_NAME] = PARSER_TRIGGER_ATTR_VALUE;
+ }
+
+ // Does the tag have the runat attribute? If so it might be a component
+ if ( isset ( $attrs[PARSER_TRIGGER_ATTR_NAME] ) ) {
+
+ // Does runat ="server"? If so it's definately a component
+ if ( strtolower($attrs[PARSER_TRIGGER_ATTR_NAME]) == PARSER_TRIGGER_ATTR_VALUE ) {
+ if (isset($this->TagInformation[$tag])) {
+ return $this->TagInformation[$tag];
+ } else {
+ // we are a generic tag. We run at the server, but have no
+ // specific TagInfo record in the dictionary.
+ if ( !$isEmpty ) {
+ $generic =& new TagInfo($tag, 'GenericContainerTag');
+ $generic->File = WACT_ROOT . '/template/compiler/generictag.inc.php';
+
+ $generic->setEndTag(ENDTAG_REQUIRED);
+ } else {
+ $generic =& new TagInfo($tag, 'GenericTag');
+ $generic->File = WACT_ROOT . '/template/compiler/generictag.inc.php';
+ $generic->setEndTag(ENDTAG_FORBIDDEN);
+ }
+ $generic->setDefaultLocation(LOCATION_CLIENT);
+
+ return $generic;
+ }
+ }
+ } else if ( isset($this->TagInformation[$tag]) ) {
+
+ $TagInfo =& $this->TagInformation[$tag];
+
+ // DefaultLocation allows the location of some tags to be specified without
+ // a corresponding runat="" attribute.
+ if ($TagInfo->DefaultLocation == LOCATION_SERVER) {
+ return $TagInfo;
+ }
+
+ //----------------------------------------------------------------------------
+ // Is the tag a known child? This applies only to sub classes of
+ // ServerTagComponentTag (tags that match HTML) and helps save adding
+ // runat="server" excessively. The only tags at this time using this are
+ // the form related tags.
+ //----------------------------------------------------------------------------
+ if ( isset($TagInfo->KnownParent) ) {
+ if ( $KnownParent = & $Component->findSelfOrParentByClass($TagInfo->KnownParent) ) {
+ if ( $KnownParent->getBoolAttribute('useknown',TRUE) ) {
+ return $TagInfo;
+ }
+ }
+ }
+ }
+ return NULL;
+ }
+}
+?>
\ No newline at end of file
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:29:40 UTC (rev 4165)
+++ 3.x/packages/wact/trunk/framework/template/compiler/templatecompiler.inc.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -21,16 +21,16 @@
require_once WACT_ROOT . '/template/compiler/compile_tree_node/PHPNode.class.php';
require_once WACT_ROOT . '/template/compiler/compile_tree_node/OutputExpression.class.php';
-require_once WACT_ROOT . '/template/compiler/tags/CompilerTag.class.php';
-require_once WACT_ROOT . '/template/compiler/tags/CompilerDirectiveTag.class.php';
-require_once WACT_ROOT . '/template/compiler/tags/ServerComponentTag.class.php';
-require_once WACT_ROOT . '/template/compiler/tags/SilentCompilerDirectiveTag.class.php';
-require_once WACT_ROOT . '/template/compiler/tags/ServerTagComponentTag.class.php';
-require_once WACT_ROOT . '/template/compiler/tags/ServerDataComponentTag.class.php';
-require_once WACT_ROOT . '/template/compiler/tags/GenericTag.class.php';
-require_once WACT_ROOT . '/template/compiler/tags/GenericContainerTag.class.php';
-require_once WACT_ROOT . '/template/compiler/tags/tagdictionary.inc.php';
-require_once WACT_ROOT . '/template/compiler/tags/WactTagInfoExtractor.class.php';
+require_once WACT_ROOT . '/template/compiler/tag_node/CompilerTag.class.php';
+require_once WACT_ROOT . '/template/compiler/tag_node/CompilerDirectiveTag.class.php';
+require_once WACT_ROOT . '/template/compiler/tag_node/ServerComponentTag.class.php';
+require_once WACT_ROOT . '/template/compiler/tag_node/SilentCompilerDirectiveTag.class.php';
+require_once WACT_ROOT . '/template/compiler/tag_node/ServerTagComponentTag.class.php';
+require_once WACT_ROOT . '/template/compiler/tag_node/ServerDataComponentTag.class.php';
+require_once WACT_ROOT . '/template/compiler/tag_node/GenericTag.class.php';
+require_once WACT_ROOT . '/template/compiler/tag_node/GenericContainerTag.class.php';
+require_once WACT_ROOT . '/template/compiler/tag_node/tagdictionary.inc.php';
+require_once WACT_ROOT . '/template/compiler/tag_node/WactTagInfoExtractor.class.php';
require_once WACT_ROOT . '/template/compiler/attribute/AttributeNode.class.php';
require_once WACT_ROOT . '/template/compiler/filter/CompilerFilter.class.php';
Deleted: 3.x/packages/wact/trunk/tests/cases/template/compiler/CompileTreeNodeTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/CompileTreeNodeTest.class.php 2006-10-16 07:29:40 UTC (rev 4165)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/CompileTreeNodeTest.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,143 +0,0 @@
-<?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/CompileTreeRootNodeTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/CompileTreeRootNodeTest.class.php 2006-10-16 07:29:40 UTC (rev 4165)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/CompileTreeRootNodeTest.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,24 +0,0 @@
-<?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/HtmlParserMalformedTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/HtmlParserMalformedTest.class.php 2006-10-16 07:29:40 UTC (rev 4165)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/HtmlParserMalformedTest.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,92 +0,0 @@
-<?php
-require_once(WACT_TEST_CASES . '/template/compiler/HtmlParserTest.class.php');
-
-class HtmlParserMalformedTest extends UnitTestCase
-{
- protected $parser;
- protected $listener;
-
- function setUp()
- {
- $this->listener = new MockParserListener();
- $this->parser = new HTMLParser($this->listener);
- }
-
- function testMalformedJasp()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<%>'));
- $this->listener->expectNever('jasp');
- $this->parser->parse('stuff<%>');
- }
-
- function testMalformedProcessingInstruction()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<?>'));
- $this->listener->expectNever('processingInstruction');
- $this->parser->parse('stuff<?>');
- }
-
- function testMalformedProcessingInstruction2()
- {
- $this->listener->expectOnce('unexpectedEOF', array('<??>'));
- $this->listener->expectNever('processingInstruction');
- $this->listener->expectNever('characters');
- $this->parser->parse('<??>');
- }
-
- function testMalformedComment()
- {
- $this->listener->expectOnce('unexpectedEOF', array('<!--x->'));
- $this->listener->expectNever('escape');
- $this->listener->expectNever('comment');
- $this->listener->expectNever('characters');
- $this->parser->parse('<!--x->');
- }
-
- function testOpenElementMalformedClose()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('invalidEntitySyntax', array('<tag attribute=\'value\'/morestuff'));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag attribute=\'value\'/morestuff');
- }
-
- function testOpenElementMalformedClose2()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('invalidEntitySyntax', array('<tag attribute=\'value\'/morestuff>'));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag attribute=\'value\'/morestuff>');
- }
-
- function testElementNestedSingleQuote()
- {
- $this->listener->expectOnce('startElement', array('tag', array('attribute' => '', "'" => NULL)));
- $this->listener->expectOnce('invalidAttributeSyntax');
- $this->listener->expectNever('characters');
- $this->listener->expectNever('endElement');
- $this->parser->parse('<tag attribute=\'\'\'>');
- }
-
- function testElementNestedDoubleQuote()
- {
- $this->listener->expectOnce('startElement', array('tag', array('attribute' => '', '"' => NULL)));
- $this->listener->expectOnce('invalidAttributeSyntax');
- $this->listener->expectNever('characters');
- $this->listener->expectNever('endElement');
- $this->parser->parse('<tag attribute=""">');
- }
-
- function testElementMalformedAttribute()
- {
- $this->listener->expectOnce('startElement', array('tag', array('attribute' => 'test', 'extra' => NULL)));
- $this->listener->expectOnce('invalidAttributeSyntax');
- $this->listener->expectNever('characters');
- $this->listener->expectNever('endElement');
- $this->parser->parse('<tag attribute="test"extra>');
- }
-}
-
-?>
\ No newline at end of file
Deleted: 3.x/packages/wact/trunk/tests/cases/template/compiler/HtmlParserTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/HtmlParserTest.class.php 2006-10-16 07:29:40 UTC (rev 4165)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/HtmlParserTest.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,299 +0,0 @@
-<?php
-require_once(WACT_ROOT . '/template/compiler/templatecompiler.inc.php');
-
-Mock::generate('ParserListener', 'MockParserListener');
-
-class HtmlParserTest extends UnitTestCase
-{
- var $parser;
- var $listener;
-
- function setUp()
- {
- $this->listener = new MockParserListener();
- $this->parser = new HTMLParser($this->listener);
- }
-
- function testEmpty()
- {
- $this->listener->expectNever('jasp');
- $this->listener->expectNever('processingInstruction');
- $this->listener->expectNever('escape');
- $this->listener->expectNever('characters');
- $this->listener->expectNever('startElement');
- $this->listener->expectNever('endElement');
- $this->parser->parse('');
- }
-
- function testSimpledata()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->parser->parse('stuff');
- }
-
- function testPreservingWhiteSpace()
- {
- $this->listener->expectOnce('characters', array(" stuff\t\r\n "));
- $this->parser->parse(" stuff\t\r\n ");
- }
-
- function testEmptyElement()
- {
- $this->listener->expectOnce('startElement', array('tag', array()));
- $this->listener->expectOnce('endElement', array('tag'));
- $this->listener->expectNever('invalidAttributeSyntax');
- $this->parser->parse('<tag></tag>');
- }
-
- function testEmptyElementSelfClose()
- {
- $this->listener->expectOnce('emptyElement', array('br', array()));
- $this->listener->expectNever('startElement');
- $this->listener->expectNever('endElement');
- $this->parser->parse('<br/>');
- }
-
- function testElementWithContent()
- {
- $this->listener->expectOnce('startElement', array('tag', array()));
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('endElement', array('tag'));
- $this->listener->expectNever('invalidAttributeSyntax');
- $this->parser->parse('<tag>stuff</tag>');
- }
-
- function testEmptyComment()
- {
- $this->listener->expectOnce('comment', array(''));
- $this->listener->expectNever('characters');
- $this->parser->parse('<!---->');
- }
-
- function testElementNestedSingleQuote()
- {
- $this->listener->expectOnce('startElement', array('tag', array('attribute' => '\'')));
- $this->listener->expectNever('characters');
- $this->listener->expectNever('endElement');
- $this->listener->expectNever('invalidAttributeSyntax');
- $this->parser->parse('<tag attribute="\'">');
- }
-
- function testElementNestedDoubleQuote()
- {
- $this->listener->expectOnce('startElement', array('tag', array('attribute' => '"')));
- $this->listener->expectNever('characters');
- $this->listener->expectNever('endElement');
- $this->listener->expectNever('invalidAttributeSyntax');
- $this->parser->parse('<tag attribute=\'"\'>');
- }
-
- function testEmptyDocType()
- {
- $this->listener->expectOnce('doctype', array('DOCTYPE'));
- $this->listener->expectNever('characters');
- $this->listener->expectNever('escape');
- $this->parser->parse('<!DOCTYPE>');
- }
-
- function testEmptyClose()
- {
- $this->listener->expectOnce('endElement', array(''));
- $this->listener->expectNever('characters');
- $this->parser->parse('</>');
- }
-
- function testEmptyJasp()
- {
- $this->listener->expectOnce('jasp', array(''));
- $this->listener->expectNever('characters');
- $this->parser->parse('<%%>');
- }
-
- function testTargetOnlyProcessingInstruction()
- {
- $this->listener->expectOnce('processingInstruction', array('php', ''));
- $this->listener->expectNever('characters');
- $this->parser->parse('<?php ?>');
- }
-
- function testElementWithPreContent()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('startElement', array('br', array()));
- $this->listener->expectNever('invalidAttributeSyntax');
- $this->parser->parse('stuff<br>');
- }
-
- function testElementWithPostContent()
- {
- $this->listener->expectOnce('startElement', array('br', array()));
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectNever('invalidAttributeSyntax');
- $this->parser->parse('<br>stuff');
- }
-
- function testExpressionAfterTag()
- {
- $this->listener->expectOnce('emptyElement', array('br', array()));
- $this->listener->expectOnce('characters', array('{$str|clip:5}'));
- $this->parser->parse('<br/>{$str|clip:5}');
- }
-
- function testExpressionAfterTagWithArguments()
- {
- $this->listener->expectOnce('emptyElement', array('core:set', array('str' => 'abcdefgh')));
- $this->listener->expectOnce('characters', array('{$str|clip:5}'));
- $this->parser->parse('<core:set str="abcdefgh" />{$str|clip:5}');
- }
-
- function testMismatchedElements()
- {
- $this->listener->expectArgumentsAt(0, 'startElement', array('b', array()));
- $this->listener->expectArgumentsAt(1, 'startElement', array('i', array()));
- $this->listener->expectArgumentsAt(0, 'endElement', array('b'));
- $this->listener->expectArgumentsAt(1, 'endElement', array('i'));
- $this->listener->expectCallCount('startElement', 2);
- $this->listener->expectCallCount('endElement', 2);
- $this->listener->expectNever('invalidAttributeSyntax');
- $this->parser->parse('<b><i>stuff</b></i>');
- }
-
- function testAttributes()
- {
- $this->listener->expectOnce('startElement', array('tag', array("a" => "A", "b" => "B", "c" => "C")));
- $this->listener->expectNever('invalidAttributeSyntax');
- $this->parser->parse('<tag a="A" b=\'B\' c = "C">');
- }
-
- function testEmptyAttributes()
- {
- $this->listener->expectOnce('startElement', array('tag', array("a" => NULL, "b" => NULL, "c" => NULL)));
- $this->listener->expectNever('invalidAttributeSyntax');
- $this->parser->parse('<tag a b c>');
- }
-
- function testNastyAttributes()
- {
- $this->listener->expectOnce('startElement', array('tag', array("a" => "&%$'?<>",
- "b" => "\r\n\t\"",
- "c" => "")));
- $this->listener->expectNever('invalidAttributeSyntax');
- $this->parser->parse("<tag a=\"&%$'?<>\" b='\r\n\t\"' c = ''>");
- }
-
- function testAttributesPadding()
- {
- $this->listener->expectOnce('startElement', array('tag', array("a" => "A", "b" => "B", "c" => "C")));
- $this->listener->expectNever('invalidAttributeSyntax');
- $this->parser->parse("<tag\ta=\"A\"\rb='B'\nc = \"C\"\n>");
- }
-
- function testAllProcessingInstruction()
- {
- $this->listener->expectOnce('processingInstruction', array('php', 'print "Hello"; '));
- $this->listener->expectNever('characters');
- $this->listener->expectNever('startElement');
- $this->listener->expectNever('endElement');
- $this->parser->parse('<?php print "Hello"; ?>');
- }
-
- function testNestedProcessingInstruction()
- {
- $this->listener->expectOnce('processingInstruction', array('php', 'print "Hello"; '));
- $this->listener->expectArgumentsAt(0, 'characters', array('a'));
- $this->listener->expectArgumentsAt(1, 'characters', array('b'));
- $this->listener->expectCallCount('characters', 2);
- $this->listener->expectNever('startElement');
- $this->listener->expectNever('endElement');
- $this->parser->parse('a<?php print "Hello"; ?>b');
- }
-
- function testEscapeDocTypeHandler()
- {
- $this->listener->expectOnce('doctype', array('doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"'));
- $this->parser->parse('<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">');
- }
-
- function testNestedDoctypeHandler()
- {
- $this->listener->expectOnce('doctype', array('doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"'));
- $this->listener->expectArgumentsAt(0, 'characters', array('a'));
- $this->listener->expectArgumentsAt(1, 'characters', array('b'));
- $this->listener->expectCallCount('characters', 2);
- $this->parser->parse('a<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">b');
- }
-
- function testEscapeCData()
- {
- $this->listener->expectOnce('cdata', array('string = \'A CDATA block\';'));
- $this->parser->parse('<![CDATA[string = \'A CDATA block\';]]>');
- }
-
- function testSimpleComment()
- {
- $this->listener->expectOnce('comment', array(' A comment '));
- $this->parser->parse('<!-- A comment -->');
- }
-
- function testNastyComment()
- {
- $this->listener->expectOnce('comment', array(' <tag></tag><?php ?><' . '% %> '));
- $this->parser->parse('<tag><!-- <tag></tag><?php ?><' . '% %> --></tag>');
- }
-
- function testSimpleJasp()
- {
- $this->listener->expectOnce('jasp', array(' document.write("Hello World");'));
- $this->listener->expectNever('processingInstruction');
- $this->listener->expectNever('comment');
- $this->listener->expectNever('escape');
- $this->listener->expectNever('characters');
- $this->listener->expectNever('startElement');
- $this->listener->expectNever('endElement');
- $this->parser->parse('<' . '% document.write("Hello World");%>');
- }
-
- function testNastyJasp()
- {
- $this->listener->expectOnce('jasp', array(' <tag a="A"><?php ?></tag><!-- comment --> '));
- $this->listener->expectNever('processingInstruction');
- $this->listener->expectNever('comment');
- $this->listener->expectNever('escape');
- $this->listener->expectNever('characters');
- $this->listener->expectNever('startElement');
- $this->listener->expectNever('endElement');
- $this->parser->parse('<' . '% <tag a="A"><?php ?></tag><!-- comment --> %>');
- }
-
- function testJaspInTag()
- {
- $this->listener->expectOnce( 'jasp', array(' document.write("Hello World");'));
- $this->listener->expectNever('processingInstruction');
- $this->listener->expectNever('escape');
- $this->listener->expectNever('characters');
- $this->listener->expectOnce('startElement');
- $this->listener->expectOnce('endElement');
- $this->parser->parse('<tag><' . '% document.write("Hello World");%></tag>');
- }
-
- /*
-// removed due to bug #1000806
-// see http://www.w3.org/TR/REC-html40/appendix/notes.html#notes-specifying-data
- function testScriptElement() {
- $this->listener->expectOnce('startElement', array('script', array('language'=>'Javascript')));
- $this->listener->expectOnce('endElement', array('script'));
- $this->listener->expectOnce('characters', array("document.write('<B>Test<\/B>');"));
- $this->listener->expectNever('invalidAttributeSyntax');
- $this->parser->parse('<script language="Javascript">document.write(\'<B>Test<\/B>\');</script>');
- }
- */
-
- function testScriptElementEmbedComment() {
- $this->listener->expectOnce('startElement', array('script', array('language'=>'Javascript')));
- $this->listener->expectOnce('endElement', array('script'));
- $this->listener->expectOnce('comment', array(" document.write('<B>Test<\/B>'); "));
- $this->listener->expectNever('invalidAttributeSyntax');
- $this->parser->parse('<script language="Javascript"><!-- document.write(\'<B>Test<\/B>\'); --></script>');
- }
-}
-?>
\ No newline at end of file
Deleted: 3.x/packages/wact/trunk/tests/cases/template/compiler/HtmlParserTruncatedTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/HtmlParserTruncatedTest.class.php 2006-10-16 07:29:40 UTC (rev 4165)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/HtmlParserTruncatedTest.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,233 +0,0 @@
-<?php
-require_once(WACT_TEST_CASES . '/template/compiler/HtmlParserTest.class.php');
-
-class HtmlParserTruncatedTest extends UnitTestCase
-{
- var $parser;
- var $listener;
-
- function setUp()
- {
- $this->listener = new MockParserListener();
- $this->parser = new HTMLParser($this->listener);
- }
-
- function testTruncatedOpen()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<'));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<');
- }
-
- function testTruncatedEmptyClose()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('</'));
- $this->listener->expectNever('endElement');
- $this->parser->parse('stuff</');
- }
-
- function testTruncatedClose()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('</a'));
- $this->parser->parse('stuff</a');
- $this->listener->expectNever('endElement');
- }
-
- function testTruncatedProcessingInstruction()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<?'));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<?');
- }
-
- function testTruncatedProcessingInstructionTarget()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<?php'));
- $this->listener->expectNever('processingInstruction');
- $this->parser->parse('stuff<?php');
- }
-
- function testTruncatedProcessingInstructionNoClose()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<?php '));
- $this->listener->expectNever('processingInstruction');
- $this->parser->parse('stuff<?php ');
- }
-
- function testTruncatedJasp()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<%'));
- $this->listener->expectNever('jasp');
- $this->parser->parse('stuff<%');
- }
-
- function testTruncatedJaspNoClose()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<% more stuff'));
- $this->listener->expectNever('jasp');
- $this->parser->parse('stuff<% more stuff');
- }
-
- function testTruncatedComment()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<!--'));
- $this->listener->expectNever('escape');
- $this->listener->expectNever('comment');
- $this->parser->parse('stuff<!--');
- }
-
- function testTruncatedCommentNoClose()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<!-- blah'));
- $this->listener->expectNever('escape');
- $this->listener->expectNever('comment');
- $this->parser->parse('stuff<!-- blah');
- }
-
- function testTruncatedDocType()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<!doctype'));
- $this->listener->expectNever('escape');
- $this->parser->parse('stuff<!doctype');
- }
-
- function testTruncatedDocTypetNoClose()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<!doctype blah'));
- $this->listener->expectNever('escape');
- $this->parser->parse('stuff<!doctype blah');
- }
-
- function testTruncatedOpenElementChar()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<a'));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<a');
- }
-
- function testTruncatedOpenElement()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<tag'));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag');
- }
-
- function testTruncatedOpenElementSpace()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<tag '));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag ');
- }
-
- function testTruncatedOpenElementMinimizedAttribute()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<tag attribute'));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag attribute');
- }
-
- function testTruncatedOpenElementMinimizedAttributeSpace()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<tag attribute '));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag attribute ');
- }
-
- function testTruncatedOpenElementAttribute()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<tag attribute='));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag attribute=');
- }
-
- function testTruncatedOpenElementAttributeSpace()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<tag attribute= '));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag attribute= ');
- }
-
- function testTruncatedOpenElementAttributeNoQuote()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<tag attribute=value'));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag attribute=value');
- }
-
- function testTruncatedOpenElementAttributeDoubleQuote()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<tag attribute="'));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag attribute="');
- }
-
- function testTruncatedOpenElementAttributeDoubleQuoteNoClose()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<tag attribute="value'));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag attribute="value');
- }
-
- function testTruncatedOpenElementAttributeDoubleQuoteValue()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<tag attribute="value"'));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag attribute="value"');
- }
-
- function testTruncatedOpenElementAttributeSingleQuote()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<tag attribute=\''));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag attribute=\'');
- }
-
- function testTruncatedOpenElementAttributeSingleQuoteNoClose()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<tag attribute=\'value'));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag attribute=\'value');
- }
-
- function testTruncatedOpenElementAttributeSingleQuoteValue()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<tag attribute=\'value\''));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag attribute=\'value\'');
- }
-
- function testTruncatedOpenElementClose()
- {
- $this->listener->expectOnce('characters', array('stuff'));
- $this->listener->expectOnce('unexpectedEOF', array('<tag attribute=\'value\'/'));
- $this->listener->expectNever('startElement');
- $this->parser->parse('stuff<tag attribute=\'value\'/');
- }
-}
-?>
\ No newline at end of file
Deleted: 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:29:40 UTC (rev 4165)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/PHPNodeTest.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,20 +0,0 @@
-<?php
-require_once WACT_TEST_CASES . '/template/compiler/CompileTreeNodeTest.class.php';
-
-class PHPNodeTest extends CompileTreeNodeTest {
- function setUp() {
- $this->component = & new PHPNode('test');
- }
-
- function tearDown() {
- unset ( $this->component );
- parent::tearDown();
- }
-
- function testGenerate() {
- $MockCode = & new MockCodeWriter($this);
- $MockCode->expectOnce('writePHP',array('test'));
- $this->component->generate($MockCode);
- }
-}
-?>
Deleted: 3.x/packages/wact/trunk/tests/cases/template/compiler/SourceFileParserTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/SourceFileParserTest.class.php 2006-10-16 07:29:40 UTC (rev 4165)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/SourceFileParserTest.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,134 +0,0 @@
-<?php
-require_once WACT_ROOT . '/template/compiler/templatecompiler.inc.php';
-
-Mock::generate('WactLiteralParsingState','MockLiteralParsingState');
-Mock::generate('WactComponentParsingState','MockComponentParsingState');
-Mock::generatePartial('SourceFileParser','SourceFileParserTestVersion', array('SourceFileParser'));
-
-class SourceFileParserTest extends UnitTestCase {
-
- function setUp()
- {
- $this->SFP = new SourceFileParserTestVersion();
- $this->SFP->ComponentParsingState = new MockComponentParsingState();
- $this->SFP->LiteralParsingState = new MockLiteralParsingState();
- $this->SFP->State = $this->SFP->ComponentParsingState;
- }
-
- function testBuildFilterChain() {
- $Parser =& $this->SFP->buildFilterChain('tagstolower');
- $this->SFP->ComponentParsingState->expectOnce('startElement', array('test', '*'));
- $Parser->startElement('TEST', array());
- }
-
- function testChangeToComponentParsingState() {
- $this->SFP->changeToComponentParsingState();
- $this->assertIsA($this->SFP->State, 'MockComponentParsingState');
- }
-
- function testChangeToLiteralParsingState() {
- $this->SFP->LiteralParsingState->expectOnce('setLiteralTag', array('test'));
- $this->SFP->changeToLiteralParsingState('test');
- $this->assertIsA($this->SFP->State, 'MockLiteralParsingState');
- }
-
- function testChangeStates() {
- $this->SFP->changeToComponentParsingState();
- $this->assertIsA($this->SFP->State, 'MockComponentParsingState');
- $this->SFP->changeToLiteralParsingState('test');
- $this->assertIsA($this->SFP->State, 'MockLiteralParsingState');
- $this->SFP->changeToComponentParsingState();
- $this->assertIsA($this->SFP->State, 'MockComponentParsingState');
- }
-
-
- function testSetDocumentLocator() {
- $this->SFP->ComponentParsingState->expectOnce('setDocumentLocator');
- $this->SFP->LiteralParsingState->expectOnce('setDocumentLocator');
- $Locator = NULL;
-
- $this->SFP->setDocumentLocator($Locator);
- }
-
- function testStartElement() {
- $tag = 'test';
- $attributes = array('foo' => 'bar');
- $this->SFP->State->expectOnce('startElement', array($tag, $attributes));
- $this->SFP->startElement($tag, $attributes);
- }
-
- function testEndElement() {
- $tag = 'test';
- $this->SFP->State->expectOnce('endElement', array($tag));
- $this->SFP->endElement($tag);
- }
-
- function testEmptyElement() {
- $tag = 'test';
- $attributes = array('foo' => 'bar');
- $this->SFP->State->expectOnce('emptyElement', array($tag, $attributes));
- $this->SFP->emptyElement($tag, $attributes);
- }
-
- function testCharacters() {
- $data = 'test';
- $this->SFP->State->expectOnce('characters', array($data));
- $this->SFP->characters($data);
- }
-
- function testCdata() {
- $data = 'test';
- $this->SFP->State->expectOnce('cdata', array($data));
- $this->SFP->cdata($data);
- }
-
- function testProcessingInstruction() {
- $target = 'test';
- $instruction = 'hi';
- $this->SFP->State->expectOnce('processingInstruction', array($target, $instruction));
- $this->SFP->processingInstruction($target, $instruction);
- }
-
- function testEscape() {
- $text = 'test';
- $this->SFP->State->expectOnce('escape', array($text));
- $this->SFP->escape($text);
- }
-
- function testComment() {
- $text = 'test';
- $this->SFP->State->expectOnce('comment', array($text));
- $this->SFP->comment($text);
- }
-
- function testDoctype() {
- $text = 'test';
- $this->SFP->State->expectOnce('doctype', array($text));
- $this->SFP->doctype($text);
- }
-
- function testJasp() {
- $text = 'test';
- $this->SFP->State->expectOnce('jasp', array($text));
- $this->SFP->jasp($text);
- }
-
- function testUnexpectedEOF() {
- $text = 'test';
- $this->SFP->State->expectOnce('unexpectedEOF', array($text));
- $this->SFP->unexpectedEOF($text);
- }
-
- function testInvalidEntitySyntax() {
- $text = 'test';
- $this->SFP->State->expectOnce('invalidEntitySyntax', array($text));
- $this->SFP->invalidEntitySyntax($text);
- }
-
- function testInvalidAttributeSyntax() {
- $this->SFP->State->expectOnce('invalidAttributeSyntax', array());
- $this->SFP->invalidAttributeSyntax();
- }
-
-}
-?>
\ No newline at end of file
Deleted: 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:29:40 UTC (rev 4165)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/TextNodeTest.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,30 +0,0 @@
-<?php
-require_once(WACT_TEST_CASES . '/template/compiler/CompileTreeNodeTest.class.php');
-
-class TextNodeTest extends CompileTreeNodeTest
-{
- function testGenerate()
- {
- $component = new TextNode('test');
-
- $code_writer = new CodeWriter();
- $component->generate($code_writer);
-
- $this->assertEqual($code_writer->getCode(), 'test');
- }
-
- function testGenerateWithChild()
- {
- $component = new TextNode('test');
- $child_component = new TextNode('test2');
- $component->addChild($child_component);
-
- $code_writer = new CodeWriter();
- $component->generate($code_writer);
-
- $this->assertEqual($code_writer->getCode(), 'testtest2');
- }
-}
-
-?>
-
Deleted: 3.x/packages/wact/trunk/tests/cases/template/compiler/WactBaseParsingStateTestCase.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/WactBaseParsingStateTestCase.class.php 2006-10-16 07:29:40 UTC (rev 4165)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/WactBaseParsingStateTestCase.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,44 +0,0 @@
-<?php
-require_once WACT_ROOT . '/template/compiler/templatecompiler.inc.php';
-
-Mock::generate('HTMLParser','MockHTMLParser');
-Mock::generate('SourceFileParser','MockSourceFileParser');
-Mock::generate('WactNodeBuilder', 'MockNodeBuilder');
-Mock::generate('WactTreeBuilder','MockTreeBuilder');
-Mock::generate('TagDictionary','MockTagDictionary');
-Mock::generate('ServerComponentTag','MockServerComponentTag');
-Mock::generate('ServerTagComponentTag','MockServerTagComponentTag');
-
-class WactBaseParsingStateTestCase extends UnitTestCase
-{
- protected $State;
-
- function testGetAttributeString()
- {
- $attrs = array('foo'=>'bar');
- $this->assertIdentical($this->state->getAttributeString($attrs), ' foo="bar"');
- $attrs = array();
- $this->assertIdentical($this->state->getAttributeString($attrs), '');
- }
-
- function testInvalidAttributeSyntax()
- {
- $Parser = new MockHTMLParser();
- $Parser->expectOnce('getPublicId');
- $Parser->expectOnce('getLineNumber');
- $this->state->setDocumentLocator($Parser);
-
- try
- {
- $this->state->invalidAttributeSyntax();
- }
- catch(WactException $e)
- {
- $this->assertWantedPattern('/INVALID_ATTRIBUTE_SYNTAX/', $e->getMessage());
- }
- }
-}
-
-SimpleTestOptions :: ignore('WactBaseParsingStateTestCase');
-
-?>
\ No newline at end of file
Deleted: 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:29:40 UTC (rev 4165)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/WactComponentParsingStateTest.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,312 +0,0 @@
-<?php
-require_once(WACT_TEST_CASES . '/template/compiler/WactBaseParsingStateTestCase.class.php');
-
-class WactComponentParsingStateTest extends WactBaseParsingStateTestCase
-{
- protected $Component;
- protected $node_builder;
- protected $HTMLParser;
-
- function setUp()
- {
- $this->component = new MockServerComponentTag();
-
- $Parser = new MockSourceFileParser();
-
- $node_builder = new MockNodeBuilder();
- $node_builder->setReturnReference('buildTagNode', $this->component);
-
- $tree_builder = new MockTreeBuilder();
- $tree_builder->component = $this->component;
- $tree_builder->setReturnReference('getCursor', $this->component);
-
- $tag_dictionary = new MockTagDictionary();
- $this->state = new WactComponentParsingState($Parser, $tree_builder, $node_builder, $tag_dictionary);
-
- $this->html_parser = new MockHTMLParser();
- $this->state->setDocumentLocator($this->html_parser);
- }
-
- function testGetAttributeStringRunat()
- {
- $attrs = array('foo'=>'bar', 'runat'=>'client');
- $this->assertIdentical($this->state->getAttributeString($attrs), ' foo="bar"');
- }
-
- function testStartElementIsPlain()
- {
- $tag = 'test';
- $attrs = array('foo'=>'bar');
-
- $this->state->TagDictionary->setReturnValue('findComponent', NULL);
- $this->state->TreeBuilder->expectOnce('pushExpectedTag',
- array($tag, PARSER_TAG_IS_PLAIN, '*'));
-
- $this->state->startElement($tag, $attrs);
- }
-
- function testStartElementIsComponent() {
- $tag = 'test';
- $attrs = array('foo'=>'bar');
-
- $info =& new TagInfo($tag, 'test');
- $info->setEndTag(ENDTAG_REQUIRED);
- $this->state->TagDictionary->setReturnReference('findComponent', $info);
-
- $this->component->setReturnValue('preParse', PARSER_REQUIRE_PARSING);
-
- $this->state->NodeBuilder->expectOnce('buildTagNode', array('*', $tag, $attrs, FALSE));
- $this->state->TreeBuilder->expectOnce('pushExpectedTag', array($tag, PARSER_TAG_IS_COMPONENT, '*'));
-
- $this->state->startElement($tag, $attrs);
- }
-
- function testStartElementLiteral()
- {
- $tag = 'test';
- $attrs = array('foo'=>'bar');
-
- $info =& new TagInfo($tag, 'test');
- $info->setEndTag(ENDTAG_REQUIRED);
- $this->state->TagDictionary->setReturnReference('findComponent', $info);
-
- $this->component->setReturnValue('preParse', PARSER_FORBID_PARSING);
-
- $this->state->Parser->expectOnce('changeToLiteralParsingState',array($tag));
-
- $this->state->startElement($tag,$attrs);
- }
-
- function testStartElementEndtagForbidden() {
- $tag = 'test';
- $attrs = array('foo'=>'bar');
-
- $info =& new TagInfo($tag, 'test');
- $info->setEndTag(ENDTAG_FORBIDDEN);
- $this->state->TagDictionary->setReturnReference('findComponent', $info);
-
- $this->component->setReturnValue('preParse',PARSER_REQUIRE_PARSING);
-
- $this->state->TreeBuilder->expectOnce('popNode', array(FALSE));
- $this->state->TreeBuilder->expectNever('pushExpectedTag');
-
- $this->state->Parser->expectOnce('changeToComponentParsingState');
-
- $this->state->startElement($tag, $attrs);
- }
-
- function testStartElementIllegalAttributeName()
- {
- $tag = 'test';
- $attrs = array('runat'=>'{$hello}');
- $this->state->Locator =& new MockHTMLParser($this);
-
- $this->component->tag = $tag;
-
- try
- {
- $this->state->startElement($tag, $attrs);
- }
- catch(WactException $e)
- {
- $this->assertWantedPattern('/ILLEGALVARREFINATTR/', $e->getMessage());
- }
- }
-
- function testEndElementIsComponent() {
- $tag = 'test';
-
- $this->state->TreeBuilder->expectOnce('popExpectedTag', array($tag, '*'));
- $this->state->TreeBuilder->setReturnValue('popExpectedTag', PARSER_TAG_IS_COMPONENT);
- $this->state->TreeBuilder->expectOnce('popNode', array(TRUE));
-
- $this->state->endElement($tag);
- }
-
- function testEndElementisPlain() {
- $tag = 'test';
-
- $this->state->TreeBuilder->expectOnce('popExpectedTag', array($tag, '*'));
- $this->state->TreeBuilder->setReturnValue('popExpectedTag', PARSER_TAG_IS_PLAIN);
- $this->state->TreeBuilder->expectNever('popNode');
- $this->state->TreeBuilder->expectOnce('addTextNode', array('</'.$tag.'>'));
-
- $this->state->endElement($tag);
- }
-
- function testEndElementNoMatch() {
- $tree_builder =& new WactTreeBuilder();
- $Component =& new CompileTreeNode();
- $tree_builder->setCursor($Component);
- $tree_builder->setDocumentLocator($this->state->Locator);
- $tree_builder->pushExpectedTag('foo', PARSER_TAG_IS_COMPONENT);
-
- $this->state->TreeBuilder =& $tree_builder;
-
- try
- {
- $this->state->endElement('bar');
- }
- catch(WactException $e)
- {
- $this->assertWantedPattern('/UNEXPECTEDCLOSE/', $e->getMessage());
- }
-
- unset($tree_builder);
- }
-
- function testEndElementForbidden()
- {
- $tag = 'test';
- $this->state->Locator =& new MockHTMLParser($this);
-
- $this->component->tag = 'test';
-
- $info = & new TagInfo($tag, 'test');
- $info->setEndTag(ENDTAG_FORBIDDEN);
- $this->state->TagDictionary->setReturnReference('getTagInfo', $info);
-
- try
- {
- $this->state->endElement($tag);
- }
- catch(WactException $e)
- {
- $this->assertWantedPattern('/UNEXPECTEDCLOSE2/', $e->getMessage());
- }
- }
-
- function testEmptyElement() {
- $tag = 'test';
- $attrs = array('foo'=>'bar');
-
- $this->state->TagDictionary->setReturnValue('findComponent', NULL);
-
- $this->state->TreeBuilder->expectNever('pushExpectedTag');
-
- $this->state->emptyElement($tag, $attrs);
- }
-
- function testEmptyElementIsComponent() {
- $tag = 'test';
- $attrs = array('foo'=>'bar');
-
- $info =& new TagInfo($tag, 'test');
- $info->setEndTag(ENDTAG_REQUIRED);
- $this->state->TagDictionary->setReturnReference('findComponent', $info);
-
- $this->component->setReturnValue('preParse', PARSER_REQUIRE_PARSING);
-
- $this->state->NodeBuilder->expectOnce('buildTagNode', array('*', $tag, $attrs, TRUE ));
- $this->state->TreeBuilder->expectOnce('pushNode');
- $this->state->TreeBuilder->expectNever('pushExpectedTag');
-
- $this->state->emptyElement($tag, $attrs);
- }
-
- function testEmptyElementLiteral() {
- $tag = 'test';
- $attrs = array('foo'=>'bar');
-
- $info =& new TagInfo($tag, 'test');
- $info->setEndTag(ENDTAG_REQUIRED);
- $this->state->TagDictionary->setReturnReference('findComponent', $info);
-
- $this->component->setReturnValue('preParse',PARSER_FORBID_PARSING);
-
- $this->state->Parser->expectOnce('changeToLiteralParsingState',array($tag));
-
- $this->state->emptyElement($tag,$attrs);
- }
-
- function testEmptyElementEndtagForbidden() {
- $tag = 'test';
- $attrs = array('foo'=>'bar');
-
- $info =& new TagInfo($tag, 'test');
- $info->setEndTag(ENDTAG_FORBIDDEN);
- $this->state->TagDictionary->setReturnReference('findComponent', $info);
-
- $this->component->setReturnValue('preParse',PARSER_REQUIRE_PARSING);
-
- $this->state->TreeBuilder->expectOnce('popNode', array(FALSE));
-
- $this->state->Parser->expectOnce('changeToComponentParsingState');
-
- $this->state->emptyElement($tag, $attrs);
- }
-
- function testEmptyElementIllegalAttributeName()
- {
- $tag = 'test';
- $attrs = array('runat'=>'{$hello}');
- $this->state->Locator =& new MockHTMLParser($this);
-
- $this->component->tag = $tag;
-
- try
- {
- $this->state->emptyElement($tag, $attrs);
- }
- catch(WactException $e)
- {
- $this->assertWantedPattern('/ILLEGALVARREFINATTR/', $e->getMessage());
- }
- }
-
- function testCharacters() {
- $text = 'test';
- $this->state->NodeBuilder->expectOnce('addContent', array('*', $text));
- $this->state->characters($text);
- }
-
- function testCdata() {
- $text = 'test';
- $this->state->NodeBuilder->expectOnce('addContent', array('*', '<![CDATA[' . $text . ']]>'));
- $this->state->cdata($text);
- }
-
- function testProcessingInstruction() {
- $target = 'test';
- $instruction = 'doit';
- $this->state->NodeBuilder->expectOnce('addProcessingInstruction', array('*', $target, $instruction));
- $this->state->processingInstruction($target, $instruction);
- }
-
- function testJasp() {
- $text = 'test';
- $this->state->NodeBuilder->expectOnce('addContent', array('*', '<%' . $text . '%>'));
- $this->state->jasp($text);
- }
-
- function testComment() {
- $text = 'test';
- $this->state->NodeBuilder->expectOnce('addContent', array('*', '<!--' . $text . '-->'));
- $this->state->comment($text);
- }
-
- function testEscape() {
- $text = 'test';
- $this->state->NodeBuilder->expectOnce('addContent', array('*', '<!' . $text . '>'));
- $this->state->escape($text);
- }
-
- function testDoctype() {
- $text = 'test';
- $this->state->NodeBuilder->expectOnce('addContent', array('*', '<!' . $text . '>'));
- $this->state->doctype($text);
- }
-
- function testUnexpectedEOF() {
- $text = 'test';
- $this->state->NodeBuilder->expectOnce('addContent', array('*', $text));
- $this->state->unexpectedEOF($text);
- }
-
- function testInvalidEntitySyntax() {
- $text = 'test';
- $this->state->NodeBuilder->expectOnce('addContent', array('*', $text));
- $this->state->invalidEntitySyntax($text);
- }
-}
-?>
\ No newline at end of file
Deleted: 3.x/packages/wact/trunk/tests/cases/template/compiler/WactLiteralParsingStateTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/WactLiteralParsingStateTest.class.php 2006-10-16 07:29:40 UTC (rev 4165)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/WactLiteralParsingStateTest.class.php 2006-10-16 07:37:58 UTC (rev 4166)
@@ -1,122 +0,0 @@
-<?php
-require_once(WACT_TEST_CASES . '/template/compiler/WactBaseParsingStateTestCase.class.php');
-
-class WactLiteralParsingStateTest extends WactBaseParsingStateTestCase
-{
- protected $state;
-
- function setUp()
- {
- $parser = new MockSourceFileParser();
- $tree_builder = new MockTreeBuilder();
- $this->state = new WactLiteralParsingState($parser, $tree_builder);
- $this->state->setDocumentLocator(new MockHTMLParser());
- }
-
- function testGetAttributeStringRunat()
- {
- $attrs = array('foo'=>'bar', 'runat'=>'client');
- $this->assertIdentical($this->state->getAttributeString($attrs), ' foo="bar" runat="client"');
- }
-
- function testStartElement()
- {
- $tag = 'test';
- $attrs = array('foo' => 'bar');
- $this->state->setLiteralTag('foo');
- $this->state->TreeBuilder->expectOnce('addTextNode', array( '<test foo="bar">'));
- $this->state->startElement($tag, $attrs);
- }
-
- function testEndElement()
- {
- $tag = 'test';
- $this->state->setLiteralTag('foo');
- $this->state->TreeBuilder->expectOnce('addTextNode', array( '</' . $tag . '>'));
- $this->state->endElement($tag);
- }
-
- function testEndElementLiteral()
- {
- $tag = 'test';
- $this->state->setLiteralTag('test');
- $this->state->TreeBuilder->expectOnce('popNode', array(TRUE));
- $this->state->Parser->expectOnce('changeToComponentParsingState');
- $this->state->endElement($tag);
- }
-
- function testEmptyElement()
- {
- $tag = 'test';
- $attrs = array('foo' => 'bar');
- $this->state->setLiteralTag('foo');
- $this->state->TreeBuilder->expectOnce('addTextNode', array( '<test foo="bar" />'));
- $this->state->emptyElement($tag, $attrs);
- }
-
- function testCharacters()
- {
- $text = 'test';
- $this->state->TreeBuilder->expectOnce('addTextNode', array($text));
- $this->state->characters($text);
- }
-
- function testCdata()
- {
- $text = 'test';
- $this->state->TreeBuilder->expectOnce('addTextNode', array('<![CDATA[' . $text . ']]>'));
- $this->state->cdata($text);
- }
-
- function testProcessingInstruction()
- {
- $target = 'test';
- $instruction = 'doit';
- $pi = '<?' . $target . ' ' . $instruction . '?>';
- $this->state->TreeBuilder->expectOnce('addTextNode', array($pi));
- $this->state->processingInstruction($target, $instruction);
- }
-
- function testJasp()
- {
- $text = 'test';
- $this->state->TreeBuilder->expectOnce('addTextNode', array('<%' . $text . '%>'));
- $this->state->jasp($text);
- }
-
- function testComment()
- {
- $text = 'test';
- $this->state->TreeBuilder->expectOnce('addTextNode', array('<!--' . $text . '-->'));
- $this->state->comment($text);
- }
-
- function testEscape()
- {
- $text = 'test';
- $this->state->TreeBuilder->expectOnce('addTextNode', array('<!' . $text . '>'));
- $this->state->escape($text);
- }
-
- function testDoctype()
- {
- $text = 'test';
- $this->state->TreeBuilder->expectOnce('addTextNode', array('<!' . $text . '>'));
- $this->state->doctype($text);
- }
-
- function testUnexpectedEOF()
- {
- $text = 'test';
- $this->