[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/macro/tests/cases/ -> lmbMacroTagDictionaryTest.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  
  10  lmb_require('limb/macro/src/lmbMacroTag.class.php');
  11  lmb_require('limb/macro/src/lmbMacroTagInfo.class.php');
  12  lmb_require('limb/macro/src/lmbMacroTagDictionary.class.php');
  13  
  14  class lmbMacroTagDictionaryTest extends UnitTestCase
  15  {
  16    protected $dictionary;
  17    protected $tag_info;
  18  
  19    function setUp()
  20    {
  21      $this->tag_info = new lmbMacroTagInfo('testtag', 'SomeTagClass');
  22      $this->dictionary = new lmbMacroTagDictionary();
  23      $this->dictionary->register($this->tag_info, $file = 'whaever');
  24    }
  25  
  26    protected function _createParentTag()
  27    {
  28      $tag_info = new lmbMacroTagInfo('some_tag', 'SomeTagClass');
  29      return new lmbMacroTag(new lmbMacroSourceLocation('file', '10'), 'some_tag', $tag_info);
  30    }
  31  
  32    function testFindTagInfo()
  33    {
  34      $this->assertIsA($this->dictionary->findTagInfo('testtag'), 'lmbMacroTagInfo');
  35    }
  36  
  37    function testRegisterTagInfoOnceOnly()
  38    {
  39      $dictionary = new lmbMacroTagDictionary();
  40      $tag_info1 = new lmbMacroTagInfo('some_tag', 'SomeTagClass');
  41      $tag_info2 = new lmbMacroTagInfo('some_tag', 'SomeTagClass');
  42      $dictionary->register($tag_info1, $file1 = 'whaever1');
  43      $dictionary->register($tag_info2, $file2 = 'whaever2');
  44  
  45      $this->assertEqual($dictionary->findTagInfo('some_tag'), $tag_info1);
  46    }
  47  
  48    function testNotATag()
  49    {
  50      $parent = $this->_createParentTag();
  51      $tag = 'notatag';
  52      $attrs = array();
  53      $this->assertFalse($this->dictionary->findTagInfo($tag, $attrs, FALSE, $parent));
  54    }
  55  }
  56  ?>


Generated: Sat Nov 22 03:48:54 2008 Cross-referenced by PHPXref 0.7