Browse Source

replacement @expectedException to setExpectedException

master
Vyacheslav Agafonov 13 years ago
parent
commit
3e1a5a0b28
  1. 17
      tests/view/PHPViewTest.php
  2. 4
      tests/view/helpers/GetViewHelperTest.php
  3. 9
      tests/view/helpers/MsgViewHelperTest.php

17
tests/view/PHPViewTest.php

@ -45,12 +45,10 @@ class PHPViewTest extends PHPUnit_Framework_TestCase
$this->assertEquals('vfs://root/views/', $this->view->getPath()); $this->assertEquals('vfs://root/views/', $this->view->getPath());
} }
/**
* @expectedException InitializationException
* @expectedExceptionMessage Configuration must have a "path" set.
*/
public function testPHPViewNullConstructor() public function testPHPViewNullConstructor()
{ {
$this->setExpectedException('InitializationException', 'Configuration must have a "path" set.');
$view = new PHPView(null); $view = new PHPView(null);
} }
@ -86,12 +84,10 @@ class PHPViewTest extends PHPUnit_Framework_TestCase
$this->assertContains('New title', Registry::get('TitleViewHelper')); $this->assertContains('New title', Registry::get('TitleViewHelper'));
} }
/**
* @expectedException GeneralException
* @expectedExceptionMessage View helper "WriteViewHelper" not found.
*/
public function testIllegalCall() public function testIllegalCall()
{ {
$this->setExpectedException('GeneralException', 'View helper "WriteViewHelper" not found.');
$this->view->write('tony'); $this->view->write('tony');
} }
@ -138,12 +134,9 @@ class PHPViewTest extends PHPUnit_Framework_TestCase
} }
/**
* @expectedException GeneralException
* @expectedExceptionMessage Template
*/
public function testErrorTemplate() public function testErrorTemplate()
{ {
$this->setExpectedException('GeneralException', 'Template');
$view = new PHPView(array('path' => 'error_path/')); $view = new PHPView(array('path' => 'error_path/'));
$result = $view->fetch('test'); $result = $view->fetch('test');

4
tests/view/helpers/GetViewHelperTest.php

@ -28,19 +28,19 @@ class GetViewHelperTest extends PHPUnit_Framework_TestCase
/** /**
* @TODO: GetViewHelper: initialize GetViewHelper::$get with empty array() * @TODO: GetViewHelper: initialize GetViewHelper::$get with empty array()
* @expectedException PHPUnit_Framework_Error
*/ */
public function testGetWithNull() public function testGetWithNull()
{ {
$this->setExpectedException('PHPUnit_Framework_Error');
$this->helper->get(null); $this->helper->get(null);
} }
/** /**
* @TODO: GetViewHelper: check $_GET not null * @TODO: GetViewHelper: check $_GET not null
* @expectedException PHPUnit_Framework_Error
*/ */
public function testGetEmptyGET() public function testGetEmptyGET()
{ {
$this->setExpectedException('PHPUnit_Framework_Error');
$result = $this->helper->get('param'); $result = $this->helper->get('param');
} }

9
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/PHPView.php';
require_once dirname(__FILE__) . '/../../../view/helpers/ViewHelper.php'; require_once dirname(__FILE__) . '/../../../view/helpers/ViewHelper.php';
require_once dirname(__FILE__) . '/../../../view/helpers/MsgViewHelper.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 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() public function testWrongType()
{ {
$this->setExpectedException('GeneralException', 'Unknown message type');
$this->helper->msg('some message', 'wrong'); $this->helper->msg('some message', 'wrong');
} }

Loading…
Cancel
Save