replace Exception on GeneralException

This commit is contained in:
Vyacheslav Agafonov
2011-11-25 13:54:31 +04:00
parent 669b68ba4a
commit 7d215c9af4
6 changed files with 15 additions and 15 deletions

View File

@ -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);
}

View File

@ -17,6 +17,7 @@ require_once dirname(__FILE__) . '/../../validator/Validator.php';
require_once dirname(__FILE__) . '/../../validator/RegexValidator.php';
require_once dirname(__FILE__) . '/../../validator/NotEmptyValidator.php';
require_once dirname(__FILE__) . '/../../validator/EmailValidator.php';
require_once dirname(__FILE__) . '/../../exception/InitializationException.php';
class FormTest extends PHPUnit_Framework_TestCase
{
@ -51,7 +52,7 @@ class FormTest extends PHPUnit_Framework_TestCase
{
$form = new NotEmptyForm();
// @TODO Fix exception type
$this->setExpectedException('Exception', 'Form::Form::isValid expects an array');
$this->setExpectedException('InitializationException', 'Form::Form::isValid expects an array');
$form->isValid('');
}

View File

@ -14,6 +14,7 @@ require_once dirname(__FILE__) . '/../../view/PHPView.php';
require_once dirname(__FILE__) . '/../../view/helpers/ViewHelper.php';
require_once dirname(__FILE__) . '/../../form/FormViewHelper.php';
require_once dirname(__FILE__) . '/../../session/Session.php';
require_once dirname(__FILE__) . '/../../exception/InitializationException.php';
class FormViewHelperTest extends PHPUnit_Framework_TestCase
{
@ -35,7 +36,7 @@ class FormViewHelperTest extends PHPUnit_Framework_TestCase
public function testFormUnsetFormName()
{
$helper = new FormViewHelper($this->view);
$this->setExpectedException('Exception', 'Form name required for helper init');
$this->setExpectedException('InitializationException', 'Form name required for helper init');
// @TODO Refactor for form name is required param?
$helper->form();
}
@ -43,7 +44,7 @@ class FormViewHelperTest extends PHPUnit_Framework_TestCase
public function testFormEmptyFormName()
{
$helper = new FormViewHelper($this->view);
$this->setExpectedException('Exception', 'Form name required for helper init');
$this->setExpectedException('InitializationException', 'Form name required for helper init');
$helper->form('');
}
@ -80,14 +81,11 @@ class FormViewHelperTest extends PHPUnit_Framework_TestCase
{
$helper = new FormViewHelper($this->view);
$helper->form($this->formname);
$value = $helper->message('field1');
$this->assertSame('<span class="error">' . $this->view->escape('Can\'t serialize "value"') . '</span>', $value);
}
public function testMessageNotSet()
{
$helper = new FormViewHelper($this->view);
$helper->form($this->formname);