|
|
@ -15,6 +15,7 @@ require_once dirname(__FILE__) . '/../../validator/NotEmptyValidator.php'; |
|
|
|
require_once dirname(__FILE__) . '/../../validator/RegexValidator.php'; |
|
|
|
require_once dirname(__FILE__) . '/../../validator/EmailValidator.php'; |
|
|
|
require_once dirname(__FILE__) . '/../../form/FormField.php'; |
|
|
|
require_once dirname(__FILE__) . '/../../exception/InitializationException.php'; |
|
|
|
|
|
|
|
class FormFieldTest extends PHPUnit_Framework_TestCase |
|
|
|
{ |
|
|
@ -100,7 +101,7 @@ class FormFieldTest extends PHPUnit_Framework_TestCase |
|
|
|
$validator = true; |
|
|
|
$tmp_form_field = new FormField(); |
|
|
|
// @TODO Fix exception type
|
|
|
|
$this->setExpectedException('Exception', 'Invalid validator provided to addValidator; must be string or iValidator'); // Text of Exception
|
|
|
|
$this->setExpectedException('InitializationException', 'Invalid validator provided to addValidator; must be string or iValidator'); // Text of Exception
|
|
|
|
$tmp_form_field->addValidator($validator); |
|
|
|
} |
|
|
|
|
|
|
@ -144,7 +145,7 @@ class FormFieldTest extends PHPUnit_Framework_TestCase |
|
|
|
$filter = new NotEmptyValidator(); |
|
|
|
$form_field = new FormField(); |
|
|
|
// @TODO Fix exception type
|
|
|
|
$this->setExpectedException('Exception', 'Invalid filter provided to addFilter; must be string or iFilter'); // Text of exception
|
|
|
|
$this->setExpectedException('InitializationException', 'Invalid filter provided to addFilter; must be string or iFilter'); // Text of exception
|
|
|
|
$form_field->addFilter($filter); |
|
|
|
} |
|
|
|
|
|
|
@ -217,7 +218,7 @@ class FormFieldTest extends PHPUnit_Framework_TestCase |
|
|
|
); |
|
|
|
$form_field = new FormField(); |
|
|
|
$form_field->addValidator('NotEmpty'); |
|
|
|
$this->setExpectedException('Exception', 'Define default message for array fields'); |
|
|
|
$this->setExpectedException('InitializationException', 'Define default message for array fields'); |
|
|
|
$form_field->isValid($test_array); |
|
|
|
} |
|
|
|
|
|
|
|