[ Index ]

PHP Cross Reference of Web Application Component Toolkit

title

Body

[close]

/tests/cases/template/components/form/ -> inputelement.test.php (source)

   1  <?php
   2  /**
   3   * @package WACT_TESTS
   4   * @version $Id: inputelement.test.php,v 1.4 2004/11/17 00:41:37 jeffmoore Exp $
   5   */
   6  /**
   7   * Includes
   8   */
   9  require_once WACT_ROOT . 'template/template.inc.php';
  10  require_once WACT_ROOT . 'template/components/form/form.inc.php';
  11  
  12  require_once TEST_CASES.'/template/components.test.php';
  13  
  14  /**
  15  * @package WACT_TESTS
  16  */
  17  class InputElementTestCase extends TagComponentTestCase {
  18  
  19  	function InputElementTestCase ($name = 'InputElementTestCase') {
  20          $this->UnitTestCase($name);
  21      }
  22  
  23  	function testValue() {
  24      
  25          $Template = '<form id="testForm" runat="server">
  26                          <input type="text" id="test" name="myInput" runat="server">
  27                      </form>';
  28          RegisterTestingTemplate('/components/form/inputelement/testvalue.html', $Template);
  29  
  30          $Page =& new Template('/components/form/inputelement/testvalue.html');
  31  
  32          $Form =& $Page->getChild('testForm');
  33  
  34          $data =& new DataSpace();
  35          $data->set('myInput','foo');
  36          
  37          $Form->registerDataSource($data);
  38          
  39          $Input =& $Page->getChild('test');
  40          ob_start();
  41          $Input->renderAttributes();
  42          ob_end_clean();
  43          $this->assertEqual('foo',$Input->getAttribute('value'));        
  44          
  45      }
  46  
  47  	function testNoValue() {
  48  
  49          $Template = '<form id="testForm" runat="server">
  50                          <input type="text" id="test" name="myInput" runat="server">
  51                      </form>';
  52          RegisterTestingTemplate('/components/form/inputelement/testnovalue.html', $Template);
  53  
  54          $Page =& new Template('/components/form/inputelement/testnovalue.html');
  55  
  56          $Form =& $Page->getChild('testForm');
  57          
  58          $Input =& $Page->getChild('test');
  59          ob_start();
  60          $Input->renderAttributes();
  61          ob_end_clean();
  62          $this->assertEqual('',$Input->getAttribute('value'));
  63  
  64      }    
  65  
  66  }
  67  ?>


Generated: Sun Nov 28 19:36:09 2004 Cross-referenced by PHPXref 0.5