From 71ffa06eaa7c075cec852b6cc4b6093a5aed4824 Mon Sep 17 00:00:00 2001 From: Vyacheslav Agafonov Date: Thu, 1 Dec 2011 12:25:27 +0400 Subject: [PATCH] replacement @expectedException to setExpectedException --- tests/exception/Error404ExceptionTest.php | 13 +++---------- tests/exception/ErrorHandlerTest.php | 5 +---- tests/exception/GeneralExceptionTest.php | 11 ++--------- tests/exception/InitializationExceptionTest.php | 11 ++--------- 4 files changed, 8 insertions(+), 32 deletions(-) diff --git a/tests/exception/Error404ExceptionTest.php b/tests/exception/Error404ExceptionTest.php index ceca9c8..1c53fff 100644 --- a/tests/exception/Error404ExceptionTest.php +++ b/tests/exception/Error404ExceptionTest.php @@ -15,22 +15,15 @@ require_once dirname(__FILE__) . '/../../exception/Error404Exception.php'; class Error404ExceptionTest extends PHPUnit_Framework_TestCase { - - /** - * @expectedException Error404Exception - */ public function testError404Exception() { + $this->setExpectedException('Error404Exception'); throw new Error404Exception(); } - - /** - * @expectedException Error404Exception - * @expectedExceptionMessage Error404Exception message - * @excpectedExceptionCode 1 - */ + public function testError404ExceptionMessage() { + $this->setExpectedException('Error404Exception', 'Error404Exception message', 10); throw new Error404Exception('Error404Exception message', 10); } diff --git a/tests/exception/ErrorHandlerTest.php b/tests/exception/ErrorHandlerTest.php index 13ec3b4..2ab199b 100644 --- a/tests/exception/ErrorHandlerTest.php +++ b/tests/exception/ErrorHandlerTest.php @@ -33,12 +33,9 @@ class ErrorHandlerTest extends PHPUnit_Framework_TestCase $this->assertEquals($eh, $my_eh); } - /** - * @expectedException ErrorException - * @expectedExceptionMessage test error - */ public function testHandleError() { + $this->setExpectedException('ErrorException', 'test error'); trigger_error("test error", E_USER_ERROR); } diff --git a/tests/exception/GeneralExceptionTest.php b/tests/exception/GeneralExceptionTest.php index 7df7139..ea069a0 100644 --- a/tests/exception/GeneralExceptionTest.php +++ b/tests/exception/GeneralExceptionTest.php @@ -14,22 +14,15 @@ require_once dirname(__FILE__) . '/../../exception/GeneralException.php'; class GeneralExceptionTest extends PHPUnit_Framework_TestCase { - - /** - * @expectedException GeneralException - */ public function testGeneralException() { + $this->setExpectedException('GeneralException'); throw new GeneralException(); } - /** - * @expectedException GeneralException - * @expectedExceptionMessage GeneralException message - * @excpectedExceptionCode 1 - */ public function testGeneralExceptionMessage() { + $this->setExpectedException('GeneralException', 'GeneralException message', 1); throw new GeneralException('GeneralException message', 1); } diff --git a/tests/exception/InitializationExceptionTest.php b/tests/exception/InitializationExceptionTest.php index 185770d..faecc03 100644 --- a/tests/exception/InitializationExceptionTest.php +++ b/tests/exception/InitializationExceptionTest.php @@ -14,22 +14,15 @@ require_once dirname(__FILE__) . '/../../exception/InitializationException.php'; class InitializationExceptionTest extends PHPUnit_Framework_TestCase { - - /** - * @expectedException InitializationException - */ public function testInitializationException() { + $this->setExpectedException('InitializationException'); throw new InitializationException(); } - /** - * @expectedException InitializationException - * @expectedExceptionMessage InitializationException message - * @excpectedExceptionCode 1 - */ public function testInitializationExceptionMessage() { + $this->setExpectedException('InitializationException', 'InitializationException message', 1); throw new InitializationException('InitializationException message', 1); } } \ No newline at end of file