[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/wact/tests/cases/compiler/tag_node/ -> WactRuntimeComponentHTMLTagTest.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/tests/cases/compiler/tag_node/WactRuntimeComponentTagTest.class.php');
  11  
  12  class WactRuntimeComponentHTMLTagTestVersion extends WactRuntimeComponentHTMLTag
  13  {
  14    public $runtimeIncludeFile = 'testinclude.inc.php';
  15    public $runtimeComponentName = 'testcomponent';
  16  }
  17  
  18  Mock::generate('WactRuntimeComponentHTMLTag','MockWactRuntimeComponentHTMLTag');
  19  
  20  Mock :: generatePartial('WactCodeWriter', 'TestingWactCodeWriter', array('getTempVariable'));
  21  
  22  class WactRuntimeComponentHTMLTagTest extends WactRuntimeComponentTagTest
  23  {
  24    protected $tag_info;
  25  
  26    function _createNode()
  27    {
  28      $this->tag_info = new WactTagInfo('test', 'WactRuntimeComponentHTMLTagTestVersion');
  29  
  30      $component = new WactRuntimeComponentHTMLTagTestVersion($this->source_location , 'test', $this->tag_info);
  31      $component->setServerId('id001');
  32      $component->hasClosingTag = TRUE;
  33  
  34      $MockParent = new MockWactCompileTreeNode();
  35      $MockParent->setReturnValue('getComponentRefCode', '$root');
  36      $MockParent->parent = null;
  37  
  38      $component->parent = $MockParent;
  39      return $component;
  40    }
  41  
  42    function testGetRenderedTag()
  43    {
  44      $this->assertEqual($this->component->getRenderedTag(), 'test');
  45    }
  46  
  47    function testGenerateBeforeContent()
  48    {
  49      $code_writer = new TestingWactCodeWriter();
  50      $code_writer->setReturnValue('getTempVariable', 'AA');
  51  
  52      $this->component->generateUniqueId($code_writer);
  53  
  54      $this->component->generateBeforeContent($code_writer);
  55      $this->assertEqual($code_writer->renderCode(),'<test<?php $components[\'AA\']->renderAttributes(); ?>>');
  56    }
  57  
  58    function testPostGenerate()
  59    {
  60      $Code = new WactCodeWriter();
  61      $this->component->generateAfterContent($Code);
  62      $this->assertEqual($Code->renderCode(), '</test>');
  63    }
  64  
  65    function testGenerateConstructor()
  66    {
  67      $Code = new WactCodeWriter();
  68      $this->component->generateConstructor($Code);
  69    }
  70  }
  71  ?>


Generated: Thu Jan 8 04:06:23 2009 Cross-referenced by PHPXref 0.7