[limb-svn] r5844 - in 3.x/trunk/limb/macro: src tests/cases
svn at limb-project.com
svn at limb-project.com
Wed May 9 03:08:02 MSD 2007
Author: pachanga
Date: 2007-05-09 03:08:01 +0400 (Wed, 09 May 2007)
New Revision: 5844
URL: http://fisheye.limb-project.com/changelog/limb/?cs=5844
Added:
3.x/trunk/limb/macro/tests/cases/lmbMacroTagDictionaryTest.class.php
Modified:
3.x/trunk/limb/macro/src/lmbMacroTagInfo.class.php
Log:
-- lmbMacroTagInfo tests added
Modified: 3.x/trunk/limb/macro/src/lmbMacroTagInfo.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/lmbMacroTagInfo.class.php 2007-05-08 22:59:01 UTC (rev 5843)
+++ 3.x/trunk/limb/macro/src/lmbMacroTagInfo.class.php 2007-05-08 23:08:01 UTC (rev 5844)
@@ -26,6 +26,16 @@
$this->tag = $tag;
$this->class = $class;
}
+
+ function getTag()
+ {
+ return $this->tag;
+ }
+
+ function setFile($file)
+ {
+ $this->file = $file;
+ }
function setForbidEndtag($flag = true)
{
Added: 3.x/trunk/limb/macro/tests/cases/lmbMacroTagDictionaryTest.class.php
===================================================================
--- 3.x/trunk/limb/macro/tests/cases/lmbMacroTagDictionaryTest.class.php (rev 0)
+++ 3.x/trunk/limb/macro/tests/cases/lmbMacroTagDictionaryTest.class.php 2007-05-08 23:08:01 UTC (rev 5844)
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Limb Web Application Framework
+ *
+ * @link http://limb-project.com
+ *
+ * @copyright Copyright © 2004-2007 BIT
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ * @version $Id$
+ * @package macro
+ */
+
+lmb_require('limb/macro/src/lmbMacroTag.class.php');
+lmb_require('limb/macro/src/lmbMacroTagInfo.class.php');
+lmb_require('limb/macro/src/lmbMacroTagDictionary.class.php');
+
+class lmbMacroTagDictionaryTest extends UnitTestCase
+{
+ protected $dictionary;
+ protected $tag_info;
+
+ function setUp()
+ {
+ $this->tag_info = new lmbMacroTagInfo('testtag', 'SomeTagClass');
+ $this->dictionary = new lmbMacroTagDictionary();
+ $this->dictionary->register($this->tag_info, $file = 'whaever');
+ }
+
+ protected function _createParentTag()
+ {
+ $tag_info = new lmbMacroTagInfo('some_tag', 'SomeTagClass');
+ return new lmbMacroTag(new lmbMacroSourceLocation('file', '10'), 'some_tag', $tag_info);
+ }
+
+ function testFindTagInfo()
+ {
+ $this->assertIsA($this->dictionary->findTagInfo('testtag'), 'lmbMacroTagInfo');
+ }
+
+ function testRegisterTagInfoOnceOnly()
+ {
+ $dictionary = new lmbMacroTagDictionary();
+ $tag_info1 = new lmbMacroTagInfo('some_tag', 'SomeTagClass');
+ $tag_info2 = new lmbMacroTagInfo('some_tag', 'SomeTagClass');
+ $dictionary->register($tag_info1, $file1 = 'whaever1');
+ $dictionary->register($tag_info2, $file2 = 'whaever2');
+
+ $this->assertEqual($dictionary->findTagInfo('some_tag'), $tag_info1);
+ }
+
+ function testNotATag()
+ {
+ $parent = $this->_createParentTag();
+ $tag = 'notatag';
+ $attrs = array();
+ $this->assertFalse($this->dictionary->findTagInfo($tag, $attrs, FALSE, $parent));
+ }
+}
+?>
\ No newline at end of file
More information about the limb-svn
mailing list