From 3e1a5a0b28350379f37c5b830380facaff6962ba Mon Sep 17 00:00:00 2001 From: Vyacheslav Agafonov Date: Thu, 1 Dec 2011 12:15:44 +0400 Subject: [PATCH] replacement @expectedException to setExpectedException --- tests/view/PHPViewTest.php | 17 +++++------------ tests/view/helpers/GetViewHelperTest.php | 4 ++-- tests/view/helpers/MsgViewHelperTest.php | 9 +++------ 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/tests/view/PHPViewTest.php b/tests/view/PHPViewTest.php index 7a0750e..1236202 100644 --- a/tests/view/PHPViewTest.php +++ b/tests/view/PHPViewTest.php @@ -45,12 +45,10 @@ class PHPViewTest extends PHPUnit_Framework_TestCase $this->assertEquals('vfs://root/views/', $this->view->getPath()); } - /** - * @expectedException InitializationException - * @expectedExceptionMessage Configuration must have a "path" set. - */ + public function testPHPViewNullConstructor() { + $this->setExpectedException('InitializationException', 'Configuration must have a "path" set.'); $view = new PHPView(null); } @@ -86,12 +84,10 @@ class PHPViewTest extends PHPUnit_Framework_TestCase $this->assertContains('New title', Registry::get('TitleViewHelper')); } - /** - * @expectedException GeneralException - * @expectedExceptionMessage View helper "WriteViewHelper" not found. - */ + public function testIllegalCall() { + $this->setExpectedException('GeneralException', 'View helper "WriteViewHelper" not found.'); $this->view->write('tony'); } @@ -138,12 +134,9 @@ class PHPViewTest extends PHPUnit_Framework_TestCase } - /** - * @expectedException GeneralException - * @expectedExceptionMessage Template - */ public function testErrorTemplate() { + $this->setExpectedException('GeneralException', 'Template'); $view = new PHPView(array('path' => 'error_path/')); $result = $view->fetch('test'); diff --git a/tests/view/helpers/GetViewHelperTest.php b/tests/view/helpers/GetViewHelperTest.php index 523fc72..0da3903 100644 --- a/tests/view/helpers/GetViewHelperTest.php +++ b/tests/view/helpers/GetViewHelperTest.php @@ -28,19 +28,19 @@ class GetViewHelperTest extends PHPUnit_Framework_TestCase /** * @TODO: GetViewHelper: initialize GetViewHelper::$get with empty array() - * @expectedException PHPUnit_Framework_Error */ public function testGetWithNull() { + $this->setExpectedException('PHPUnit_Framework_Error'); $this->helper->get(null); } /** * @TODO: GetViewHelper: check $_GET not null - * @expectedException PHPUnit_Framework_Error */ public function testGetEmptyGET() { + $this->setExpectedException('PHPUnit_Framework_Error'); $result = $this->helper->get('param'); } diff --git a/tests/view/helpers/MsgViewHelperTest.php b/tests/view/helpers/MsgViewHelperTest.php index 4e81fbb..1c83619 100644 --- a/tests/view/helpers/MsgViewHelperTest.php +++ b/tests/view/helpers/MsgViewHelperTest.php @@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/../../../view/iView.php'; require_once dirname(__FILE__) . '/../../../view/PHPView.php'; require_once dirname(__FILE__) . '/../../../view/helpers/ViewHelper.php'; require_once dirname(__FILE__) . '/../../../view/helpers/MsgViewHelper.php'; -require_once dirname(__FILE__) . '/../../../exception/InitializationException.php'; +require_once dirname(__FILE__) . '/../../../exception/GeneralException.php'; class MsgViewHelperTest extends PHPUnit_Framework_TestCase { @@ -39,13 +39,10 @@ class MsgViewHelperTest extends PHPUnit_Framework_TestCase } - - /** - * @expectedException GeneralException - * @expectedExceptionMessage Unknown message type - */ + public function testWrongType() { + $this->setExpectedException('GeneralException', 'Unknown message type'); $this->helper->msg('some message', 'wrong'); }