[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/wact/tests/cases/compiler/property/ -> WactPropertyDictionaryTest.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  require_once('limb/wact/src/compiler/property/WactPropertyDictionary.class.php');
  11  require_once('limb/wact/src/compiler/property/WactCompilerProperty.class.php');
  12  
  13  class WactSomePropertyTagClass
  14  {
  15  }
  16  
  17  class WactSomeChildPropertyTagClass extends WactSomePropertyTagClass
  18  {
  19  }
  20  
  21  
  22  class WactPropertyDictionaryTest extends UnitTestCase
  23  {
  24    function testGetPropertyList()
  25    {
  26      $dict = new WactPropertyDictionary();
  27      $info = new WactPropertyInfo('name', 'WactSomePropertyTagClass', 'NoClass');
  28      $dict->registerPropertyInfo($info, $file = 'whatever');
  29      $test_tag_list = array('name' => $info);
  30  
  31      $tag = new WactSomeChildPropertyTagClass();
  32      $this->assertEqual($dict->getPropertyList($tag), $test_tag_list);
  33    }
  34  
  35    function testGetPropertyListEmpty()
  36    {
  37      $dict = new WactPropertyDictionary();
  38      $info = new WactPropertyInfo('name', 'WactSomeChildPropertyTagClass', 'NoClass');
  39      $dict->registerPropertyInfo($info, $file = 'whatever');
  40      $test_tag_list = array('name' => $info);
  41  
  42      $tag = new WactSomePropertyTagClass();
  43      $this->assertEqual($dict->getPropertyList($tag), array());
  44    }
  45  
  46    function testRegisterPropertyInfoOnceOnly()
  47    {
  48      $dictionary = new WactPropertyDictionary();
  49      $info1 = new WactPropertyInfo('name', 'WactSomePropertyTagClass', 'NoClass');
  50      $info2 = new WactPropertyInfo('name', 'WactSomePropertyTagClass', 'NoClass');
  51      $dictionary->registerPropertyInfo($info1, $file1 = 'whatever1');
  52      $dictionary->registerPropertyInfo($info2, $file2 = 'whatever2');
  53  
  54      $tag = new WactSomeChildPropertyTagClass();
  55      $this->assertEqual($dictionary->getPropertyList($tag), array('name' => $info1));
  56    }
  57  
  58    function testgetPropertyListForParentAndChildTag()
  59    {
  60      $dictionary = new WactPropertyDictionary();
  61      $info1 = new WactPropertyInfo('name1', 'WactSomePropertyTagClass', 'NoClass');
  62      $info2 = new WactPropertyInfo('name2', 'WactSomeChildPropertyTagClass', 'NoClass');
  63      $dictionary->registerPropertyInfo($info1, $file1 = 'whatever1');
  64      $dictionary->registerPropertyInfo($info2, $file2 = 'whatever2');
  65  
  66      $tag = new WactSomeChildPropertyTagClass();
  67      $this->assertEqual($dictionary->getPropertyList($tag), array('name1' => $info1,
  68                                                                   'name2' => $info2));
  69    }
  70  }
  71  ?>


Generated: Mon Dec 1 03:56:46 2008 Cross-referenced by PHPXref 0.7