| [ Index ] |
PHP Cross Reference of Web Application Component Toolkit |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package WACT_TESTS 4 * @version $Id: errorsummary.test.php,v 1.4 2004/06/19 17:03:02 jeffmoore Exp $ 5 */ 6 7 /** 8 * @package WACT_TESTS 9 */ 10 class ExamplesTagsErrorSummaryTestCase extends WACTWebTestCase { 11 function ExamplesTagsErrorSummaryTestCase($name = 'WebTestCase') { 12 $this->WACTWebTestCase($name); 13 } 14 15 function testExists() { 16 $this->assertTrue($this->get(WACT_EXAMPLES_HTTP_PATH . '/tags/form/errorsummary.php')); 17 $this->assertNormalPage(); 18 } 19 20 function testNoData() { 21 $this->assertTrue($this->get(WACT_EXAMPLES_HTTP_PATH . '/tags/form/errorsummary.php')); 22 $this->assertResponse(array(200)); 23 24 $this->assertNormalPage(); 25 $this->assertField('LastName', ''); 26 $this->assertField('FirstName', ''); 27 28 $this->assertTrue($this->clickSubmit('Add Contact')); 29 30 $this->assertNormalPage(); 31 $this->assertField('FirstName', ''); 32 $this->assertField('LastName', ''); 33 34 $this->assertWantedPattern('/class="Preview"> </'); 35 36 $this->assertWantedPattern('/<label\s+for="FirstName"\s+class="Error"/'); 37 $this->assertWantedPattern('/<label\s+for="LastName"\s+class="Error"/'); 38 39 $this->assertWantedPattern('/COLOR="RED">First Name is required/'); 40 $this->assertWantedPattern('/COLOR="RED">Last Name is required/'); 41 42 $this->assertWantedPattern('/class="Error">First Name is required/'); 43 $this->assertWantedPattern('/class="Error">Last Name is required/'); 44 45 $this->assertWantedPattern('/Some Errors Occurred/'); 46 } 47 48 function testFirstNameOnly() { 49 $this->assertTrue($this->get(WACT_EXAMPLES_HTTP_PATH . '/tags/form/errorsummary.php')); 50 $this->assertResponse(array(200)); 51 52 $this->assertNormalPage(); 53 $this->assertField('LastName', ''); 54 $this->assertTrue($this->setField('FirstName', 'Jane')); 55 56 $this->assertTrue($this->clickSubmit('Add Contact')); 57 58 $this->assertNormalPage(); 59 $this->assertField('FirstName', 'Jane'); 60 $this->assertField('LastName', ''); 61 62 $this->assertWantedPattern('/class="Preview">Jane </'); 63 64 $this->assertNoUnWantedPattern('/<label\s+for="FirstName"\s+class="Error"/'); 65 $this->assertWantedPattern('/<label\s+for="LastName"\s+class="Error"/'); 66 67 $this->assertNoUnWantedPattern('/COLOR="RED">First Name is required/'); 68 $this->assertWantedPattern('/COLOR="RED">Last Name is required/'); 69 70 $this->assertNoUnWantedPattern('/class="Error">First Name is required/'); 71 $this->assertWantedPattern('/class="Error">Last Name is required/'); 72 73 $this->assertWantedPattern('/Some Errors Occurred/'); 74 } 75 76 function testLastNameOnly() { 77 $this->assertTrue($this->get(WACT_EXAMPLES_HTTP_PATH . '/tags/form/errorsummary.php')); 78 $this->assertResponse(array(200)); 79 80 $this->assertNormalPage(); 81 $this->assertField('FirstName', ''); 82 $this->assertTrue($this->setField('LastName', 'Doe')); 83 84 $this->assertTrue($this->clickSubmit('Add Contact')); 85 86 $this->assertNormalPage(); 87 $this->assertField('FirstName', ''); 88 $this->assertField('LastName', 'Doe'); 89 90 $this->assertWantedPattern('/class="Preview"> Doe</'); 91 92 $this->assertWantedPattern('/<label\s+for="FirstName"\s+class="Error"/'); 93 $this->assertNoUnWantedPattern('/<label\s+for="LastName"\s+class="Error"/'); 94 95 $this->assertWantedPattern('/COLOR="RED">First Name is required/'); 96 $this->assertNoUnWantedPattern('/COLOR="RED">Last Name is required/'); 97 98 $this->assertWantedPattern('/class="Error">First Name is required/'); 99 $this->assertNoUnWantedPattern('/class="Error">Last Name is required/'); 100 101 $this->assertWantedPattern('/Some Errors Occurred/'); 102 } 103 104 function testBothPreview() { 105 $this->assertTrue($this->get(WACT_EXAMPLES_HTTP_PATH . '/tags/form/errorsummary.php')); 106 $this->assertResponse(array(200)); 107 108 $this->assertNormalPage(); 109 $this->assertTrue($this->setField('FirstName', 'Jane')); 110 $this->assertTrue($this->setField('LastName', 'Doe')); 111 112 $this->assertTrue($this->clickSubmit('Preview')); 113 114 $this->assertNormalPage(); 115 $this->assertField('FirstName', 'Jane'); 116 $this->assertField('LastName', 'Doe'); 117 118 $this->assertWantedPattern('/class="Preview">Jane Doe</'); 119 120 $this->assertNoUnWantedPattern('/<label\s+for="FirstName"\s+class="Error"/'); 121 $this->assertNoUnWantedPattern('/<label\s+for="LastName"\s+class="Error"/'); 122 123 $this->assertNoUnWantedPattern('/COLOR="RED">First Name is required/'); 124 $this->assertNoUnWantedPattern('/COLOR="RED">Last Name is required/'); 125 126 $this->assertNoUnWantedPattern('/class="Error">First Name is required/'); 127 $this->assertNoUnWantedPattern('/class="Error">Last Name is required/'); 128 129 $this->assertNoUnWantedPattern('/Some Errors Occurred/'); 130 $this->assertNoUnWantedPattern('/Thank You/'); 131 } 132 133 function testThankYou() { 134 $this->assertTrue($this->get(WACT_EXAMPLES_HTTP_PATH . '/tags/form/errorsummary.php')); 135 $this->assertResponse(array(200)); 136 137 $this->assertNormalPage(); 138 $this->assertTrue($this->setField('FirstName', 'Jane')); 139 $this->assertTrue($this->setField('LastName', 'Doe')); 140 141 $this->assertTrue($this->clickSubmit('Add Contact')); 142 143 $this->assertNormalPage(); 144 $this->assertWantedPattern('/Thank You/'); 145 $this->assertWantedPattern('/Jane/'); 146 $this->assertWantedPattern('/Doe/'); 147 } 148 149 } 150 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sun Nov 28 19:36:09 2004 | Cross-referenced by PHPXref 0.5 |