From 0ade94a5ea18f10febdc170fda38b4a4848c13ab Mon Sep 17 00:00:00 2001 From: Vyacheslav Agafonov Date: Thu, 1 Dec 2011 12:08:20 +0400 Subject: [PATCH] replacement @expectedException to setExpectedException --- tests/validator/RegexValidatorTest.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/validator/RegexValidatorTest.php b/tests/validator/RegexValidatorTest.php index 07687aa..95a9479 100644 --- a/tests/validator/RegexValidatorTest.php +++ b/tests/validator/RegexValidatorTest.php @@ -45,12 +45,10 @@ class RegexValidatorTest extends PHPUnit_Framework_TestCase $this->assertEquals('i am ok', $validator->getMessage()); } - /** - * @expectedException GeneralException - * @expectedExceptionMessage Message template "regex_not_match" unknown. - */ + public function testNullMessage() { + $this->setExpectedException('GeneralException', 'Message template "regex_not_match" unknown.'); $validator = new RegexValidator('/a/i'); $validator->setMessage(null, null); $validator->isValid('1212'); @@ -58,20 +56,17 @@ class RegexValidatorTest extends PHPUnit_Framework_TestCase /** * @TODO: RegexValidator - wrong regex throws an error. Check this. - * @expectedException PHPUnit_Framework_Error */ public function testWrongRegexp() { + $this->setExpectedException('PHPUnit_Framework_Error'); $validator = new RegexValidator('/^[a-z][0-9]$*/i'); $this->assertFalse($validator->isValid('to423$%ny')); } - /** - * @expectedException GeneralException - * @expectedExceptionMessage regex - */ public function testRegexReturnsFalse() - { + { + $this->setExpectedException('GeneralException', 'regex'); $validator = new RegexValidator('/(?:\D+|<\d+>)*[!?]/'); $this->assertFalse($validator->isValid('foobar foobar foobar')); }