|
@@ 69-81 (lines=13) @@
|
| 66 |
|
$result = $validation->is_unique_username('FooBar'); |
| 67 |
|
$this->assertTrue($result); |
| 68 |
|
} |
| 69 |
|
public function test_is_unique_username_fail() { |
| 70 |
|
//username already exists, return false |
| 71 |
|
|
| 72 |
|
$validation = $this->getDouble( |
| 73 |
|
'MY_Form_validation', |
| 74 |
|
['is_unique' => FALSE] |
| 75 |
|
); |
| 76 |
|
$this->verifyInvokedOnce($validation, 'is_unique'); |
| 77 |
|
|
| 78 |
|
$result = $validation->is_unique_username('FooBar'); |
| 79 |
|
$this->assertEquals('The username already exists in our database.', $this->get_error_message('is_unique_username', $validation)); |
| 80 |
|
$this->assertFalse($result); |
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
public function test_is_unique_email_pass() { |
| 84 |
|
//email is unique, return true |
|
@@ 95-107 (lines=13) @@
|
| 92 |
|
$result = $validation->is_unique_email('[email protected]'); |
| 93 |
|
$this->assertTrue($result); |
| 94 |
|
} |
| 95 |
|
public function test_is_unique_email_fail() { |
| 96 |
|
//email already exists, return false |
| 97 |
|
|
| 98 |
|
$validation = $this->getDouble( |
| 99 |
|
'MY_Form_validation', |
| 100 |
|
['is_unique' => FALSE] |
| 101 |
|
); |
| 102 |
|
$this->verifyInvokedOnce($validation, 'is_unique'); |
| 103 |
|
|
| 104 |
|
$result = $validation->is_unique_email('[email protected]'); |
| 105 |
|
$this->assertEquals('The email already exists in our database.', $this->get_error_message('is_unique_email', $validation)); |
| 106 |
|
$this->assertFalse($result); |
| 107 |
|
} |
| 108 |
|
|
| 109 |
|
public function test_isRuleValid_pass() { |
| 110 |
|
//rule exists and has no errors, returns true |