[ Index ]

PHP Cross Reference of Web Application Component Toolkit

title

Body

[close]

/tests/cases/examples/tags/form/ -> input.test.php (source)

   1  <?php
   2  /**
   3   * @package WACT_TESTS
   4   * @version $Id: input.test.php,v 1.2 2004/06/19 18:45:24 jeffmoore Exp $
   5   */
   6  
   7  /**
   8   * @package WACT_TESTS
   9   */
  10  class ExamplesTagsInputTestCase extends WACTWebTestCase {
  11      function ExamplesTagsInputTestCase($name = 'WebTestCase') {
  12          $this->WACTWebTestCase($name);
  13      }
  14  
  15      function testExists() {
  16          $this->assertTrue($this->get(WACT_EXAMPLES_HTTP_PATH . '/tags/form/input.php'));
  17          $this->assertNormalPage();
  18      }
  19  
  20      function testNoData() {
  21          $this->assertTrue($this->get(WACT_EXAMPLES_HTTP_PATH . '/tags/form/input.php'));
  22  
  23          $this->assertNormalPage();
  24          $this->assertField('username', '');
  25          $this->assertField('password', '');
  26          $this->assertField('passwordconfirm', '');
  27          $this->assertField('terms', FALSE);
  28          $this->assertField('frequency', 'occasionally');
  29          
  30          $this->assertTrue($this->clickSubmit('Register'));
  31  
  32          $this->assertNormalPage();
  33          $this->assertField('username', '');
  34          $this->assertField('password', '');
  35          $this->assertField('passwordconfirm', '');
  36          $this->assertField('terms', FALSE);
  37          $this->assertField('frequency', 'occasionally');
  38          
  39          $this->assertWantedPattern('/User Name is required/');
  40          $this->assertWantedPattern('/Password is required/');
  41          $this->assertWantedPattern('/Password Confirmation is required/');
  42          $this->assertWantedPattern('/You must agree to the Terms of Service/');
  43      }
  44  
  45      function testPartialSubmit() {
  46          $this->assertTrue($this->get(WACT_EXAMPLES_HTTP_PATH . '/tags/form/input.php'));
  47  
  48          $this->assertNormalPage();
  49          $this->assertField('username', '');
  50          $this->assertField('password', '');
  51          $this->assertField('passwordconfirm', '');
  52          $this->assertField('terms', FALSE);
  53          $this->assertField('frequency', 'occasionally');
  54          
  55          $this->assertTrue($this->setField('terms', 'checkbox'));
  56          $this->assertTrue($this->setField('username', 'Jeff'));
  57          $this->assertTrue($this->setField('frequency', 'excessive'));
  58          
  59          $this->assertTrue($this->clickSubmit('Register'));
  60  
  61          $this->assertNormalPage();
  62          $this->assertField('username', 'Jeff');
  63          $this->assertField('password', '');
  64          $this->assertField('passwordconfirm', '');
  65          $this->assertField('terms', 'checkbox');
  66          $this->assertField('frequency', 'excessive');
  67          
  68          $this->assertNoUnWantedPattern('/User Name is required/');
  69          $this->assertWantedPattern('/Password is required/');
  70          $this->assertWantedPattern('/Password Confirmation is required/');
  71          $this->assertNoUnWantedPattern('/You must agree to the Terms of Service/');
  72      }
  73  
  74      function testPassword() {
  75          $this->assertTrue($this->get(WACT_EXAMPLES_HTTP_PATH . '/tags/form/input.php'));
  76  
  77          $this->assertNormalPage();
  78          $this->assertField('username', '');
  79          $this->assertField('password', '');
  80          $this->assertField('passwordconfirm', '');
  81          $this->assertField('terms', FALSE);
  82          $this->assertField('frequency', 'occasionally');
  83          
  84          $this->assertTrue($this->setField('password', 'secret'));
  85          
  86          $this->assertTrue($this->clickSubmit('Register'));
  87  
  88          $this->assertNormalPage();
  89          $this->assertField('username', '');
  90          $this->assertField('password', '');
  91          $this->assertField('passwordconfirm', '');
  92          $this->assertField('terms', FALSE);
  93          $this->assertField('frequency', 'occasionally');
  94          
  95          $this->assertWantedPattern('/Password Confirmation is required/');
  96          $this->assertNoUnWantedPattern('/secret/i');
  97      }
  98  
  99      function testPasswordMismatch() {
 100          $this->assertTrue($this->get(WACT_EXAMPLES_HTTP_PATH . '/tags/form/input.php'));
 101  
 102          $this->assertNormalPage();
 103          $this->assertField('username', '');
 104          $this->assertField('password', '');
 105          $this->assertField('passwordconfirm', '');
 106          $this->assertField('terms', FALSE);
 107          $this->assertField('frequency', 'occasionally');
 108          
 109          $this->assertTrue($this->setField('password', 'secret'));
 110          $this->assertTrue($this->setField('passwordconfirm', 'terces'));
 111          
 112          $this->assertTrue($this->clickSubmit('Register'));
 113  
 114          $this->assertNormalPage();
 115          $this->assertField('username', '');
 116          $this->assertField('password', '');
 117          $this->assertField('passwordconfirm', '');
 118          $this->assertField('terms', FALSE);
 119          $this->assertField('frequency', 'occasionally');
 120          
 121          $this->assertWantedPattern('/Password does not match Password Confirmation/');
 122          $this->assertNoUnWantedPattern('/Password Confirmation is required/');
 123          $this->assertNoUnWantedPattern('/secret/i');
 124      }
 125  
 126      function testSubmit() {
 127          $this->assertTrue($this->get(WACT_EXAMPLES_HTTP_PATH . '/tags/form/input.php'));
 128  
 129          $this->assertNormalPage();
 130          $this->assertField('username', '');
 131          $this->assertField('password', '');
 132          $this->assertField('passwordconfirm', '');
 133          $this->assertField('terms', FALSE);
 134          $this->assertField('frequency', 'occasionally');
 135          
 136          $this->assertTrue($this->setField('password', 'secret'));
 137          $this->assertTrue($this->setField('passwordconfirm', 'secret'));
 138          $this->assertTrue($this->setField('terms', 'checkbox'));
 139          $this->assertTrue($this->setField('username', 'Jeff'));
 140          $this->assertTrue($this->setField('frequency', 'excessive'));
 141          
 142          $this->assertTrue($this->clickSubmit('Register'));
 143  
 144          $this->assertNormalPage();
 145  
 146          $this->assertWantedPattern('/Thank You/');
 147          $this->assertWantedPattern('/Jeff/');
 148      }
 149  
 150  
 151  }
 152  ?>


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