[ Index ]

PHP Cross Reference of Web Application Component Toolkit

title

Body

[close]

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

   1  <?php
   2  /**
   3   * @package WACT_TESTS
   4   * @version $Id: optionrenderer.test.php,v 1.2 2004/11/12 21:25:16 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  /**
  13  * @package WACT_TESTS
  14  */
  15  class OptionRenderTestCase extends UnitTestCase {
  16  
  17      var $OR;
  18  
  19  	function OptionRenderTestCase ($name = 'OptionRender') {
  20          $this->UnitTestCase($name);
  21      }
  22  
  23  	function setUp() {
  24          $this->OR = & new OptionRenderer();
  25      }
  26  
  27  	function tearDown() {
  28          unset($this->OR);
  29      }
  30  
  31  	function testRender() {
  32          ob_start();
  33          $this->OR->renderOption('foo','bar',FALSE);
  34          $out = ob_get_contents();
  35          ob_end_clean();
  36          $this->assertEqual($out,'<option value="foo">bar</option>');
  37      }
  38  
  39  	function testRenderNoContents() {
  40          ob_start();
  41          $this->OR->renderOption('foo','',FALSE);
  42          $out = ob_get_contents();
  43          ob_end_clean();
  44          $this->assertEqual($out,'<option value="foo">foo</option>');
  45      }
  46  
  47  	function testRenderEntities() {
  48          ob_start();
  49          $this->OR->renderOption('x > y','& v < z',FALSE);
  50          $out = ob_get_contents();
  51          ob_end_clean();
  52          $this->assertEqual($out,'<option value="x &gt; y">&amp; v &lt; z</option>');
  53      }
  54  
  55  	function testRenderEntitiesNoContents() {
  56          ob_start();
  57          $this->OR->renderOption('x > y',FALSE,FALSE);
  58          $out = ob_get_contents();
  59          ob_end_clean();
  60          $this->assertEqual($out,'<option value="x &gt; y">x &gt; y</option>');
  61      }
  62  
  63  	function testSelected() {
  64          ob_start();
  65          $this->OR->renderOption('foo','bar',TRUE);
  66          $out = ob_get_contents();
  67          ob_end_clean();
  68          $this->assertEqual($out,'<option value="foo" selected>bar</option>');
  69      }
  70  
  71  
  72  }
  73  ?>


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