|
@@ 109-121 (lines=13) @@
|
| 106 |
|
$this->assertFalse($result); |
| 107 |
|
} |
| 108 |
|
|
| 109 |
|
public function test_isRuleValid_pass() { |
| 110 |
|
//rule exists and has no errors, returns true |
| 111 |
|
|
| 112 |
|
//FIXME: This really isn't the best way to check this... |
| 113 |
|
$validation = $this->getDouble( |
| 114 |
|
'MY_Form_validation', |
| 115 |
|
['has_rule' => TRUE, 'error_array' => []] |
| 116 |
|
); |
| 117 |
|
$this->verifyInvokedOnce($validation, 'has_rule'); |
| 118 |
|
|
| 119 |
|
$result = $validation->isRuleValid('valid_username'); |
| 120 |
|
$this->assertTrue($result); |
| 121 |
|
} |
| 122 |
|
public function test_isRuleValid_fail_1() { |
| 123 |
|
//rule exists but has errors, returns false |
| 124 |
|
|
|
@@ 136-148 (lines=13) @@
|
| 133 |
|
$result = $validation->isRuleValid('valid_username'); |
| 134 |
|
$this->assertFalse($result); |
| 135 |
|
} |
| 136 |
|
public function test_isRuleValid_fail_2() { |
| 137 |
|
//rule does not exist, returns false |
| 138 |
|
|
| 139 |
|
//FIXME: This really isn't the best way to check this... |
| 140 |
|
$validation = $this->getDouble( |
| 141 |
|
'MY_Form_validation', |
| 142 |
|
['has_rule' => FALSE] |
| 143 |
|
); |
| 144 |
|
$this->verifyInvokedOnce($validation, 'has_rule'); |
| 145 |
|
|
| 146 |
|
$result = $validation->isRuleValid('valid_username'); |
| 147 |
|
$this->assertFalse($result); |
| 148 |
|
} |
| 149 |
|
|
| 150 |
|
//utility functions |
| 151 |
|
function get_error_message(/*str*/$field, /*obj*/ $customObj = FALSE) { |