[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/wact/tests/cases/tags/form/ -> WactSelectTagTest.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/WactTemplateTestCase.class.php');
  11  
  12  class WactSelectTagTest extends WactTemplateTestCase
  13  {
  14    function testSelectSingle()
  15    {
  16      $template = '<form runat="server">'.
  17                    '<select id="test" name="mySelect" runat="server"></select>'.
  18                  '</form>';
  19      $this->registerTestingTemplate('/tags/form/controls/select/selectsingle.html', $template);
  20  
  21      $page = $this->initTemplate('/tags/form/controls/select/selectsingle.html');
  22      $this->assertIsA($page->findChild('test'),'WactSelectSingleComponent');
  23    }
  24  
  25    function testSelectMultiple()
  26    {
  27      $template = '<form runat="server">'.
  28                    '<select id="test" name="foo[]" runat="server" multiple="true"></select>'.
  29                  '</form>';
  30      $this->registerTestingTemplate('/tags/form/controls/select/selectmultiple.html', $template);
  31  
  32      $page = $this->initTemplate('/tags/form/controls/select/selectmultiple.html');
  33      $this->assertIsA($page->findChild('test'),'WactSelectMultipleComponent');
  34    }
  35  
  36    function testSelectMultipleByName()
  37    {
  38      $template = '<form runat="server">'.
  39                    '<select name="test[]" runat="server" multiple="true"></select>'.
  40                  '</form>';
  41      $this->registerTestingTemplate('/tags/form/controls/select/selectmultiplebyname.html', $template);
  42  
  43      $page = $this->initTemplate('/tags/form/controls/select/selectmultiplebyname.html');
  44      $this->assertIsA($page->findChild('test'),'WactSelectMultipleComponent');
  45  
  46    }
  47  
  48    function testSelectMultipleControlArrayRequired()
  49    {
  50      $template = '<form runat="server">'.
  51                    '<select id="test" name="mySelect" runat="server" multiple="true"></select>'.
  52                  '</form>';
  53      $this->registerTestingTemplate('/tags/form/controls/select/selectmultiplecontrolarray.html', $template);
  54  
  55      try
  56      {
  57        $page = $this->initTemplate('/tags/form/controls/select/selectmultiplecontrolarray.html');
  58        $this->assertTrue(false);
  59      }
  60      catch(WactException $e)
  61      {
  62        $this->assertWantedPattern('/"\[\]" required/', $e->getMessage());
  63      }
  64    }
  65  }
  66  ?>


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