mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
test: Replace deprecated @expectedException* to expectWarning*()/expectNotice*()
This commit is contained in:
parent
eaefdbb977
commit
c04692f76c
7 changed files with 10 additions and 10 deletions
|
@ -128,10 +128,10 @@ class CacheTest extends CakeTestCase {
|
|||
*
|
||||
* Test that the cache class doesn't cause fatal errors with a partial path
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error_Warning
|
||||
* @return void
|
||||
*/
|
||||
public function testInvalidConfig() {
|
||||
$this->expectWarning();
|
||||
// In debug mode it would auto create the folder.
|
||||
$debug = Configure::read('debug');
|
||||
Configure::write('debug', 0);
|
||||
|
|
|
@ -60,10 +60,10 @@ class CrudAuthorizeTest extends CakeTestCase {
|
|||
/**
|
||||
* test authorize() without a mapped action, ensure an error is generated.
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error_Warning
|
||||
* @return void
|
||||
*/
|
||||
public function testAuthorizeNoMappedAction() {
|
||||
$this->expectWarning();
|
||||
$request = new CakeRequest('/posts/foobar', false);
|
||||
$request->addParams(array(
|
||||
'controller' => 'posts',
|
||||
|
|
|
@ -170,9 +170,9 @@ class CakePluginTest extends CakeTestCase {
|
|||
* Tests that loading a missing routes file throws a warning
|
||||
*
|
||||
* @return void
|
||||
* @expectedException PHPUNIT_FRAMEWORK_ERROR_WARNING
|
||||
*/
|
||||
public function testLoadMultipleWithDefaultsMissingFile() {
|
||||
$this->expectWarning();
|
||||
CakePlugin::load(array('TestPlugin', 'TestPluginTwo'), array('bootstrap' => true, 'routes' => true));
|
||||
CakePlugin::routes();
|
||||
}
|
||||
|
|
|
@ -101,11 +101,11 @@ class CakeValidationRuleTest extends CakeTestCase {
|
|||
/**
|
||||
* Make sure errors are triggered when validation is missing.
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error_Warning
|
||||
* @expectedExceptionMessage Could not find validation handler totallyMissing for fieldName
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomMethodMissingError() {
|
||||
$this->expectWarning();
|
||||
$this->expectWarningMessage('Could not find validation handler totallyMissing for fieldName');
|
||||
$def = array('rule' => array('totallyMissing'));
|
||||
$data = array(
|
||||
'fieldName' => 'some data'
|
||||
|
|
|
@ -206,10 +206,10 @@ class JsHelperTest extends CakeTestCase {
|
|||
/**
|
||||
* test that methods dispatch internally and to the engine class
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error_Warning
|
||||
* @return void
|
||||
*/
|
||||
public function testMethodDispatching() {
|
||||
$this->expectWarning();
|
||||
$this->_useMock();
|
||||
|
||||
$this->Js->TestJsEngine
|
||||
|
|
|
@ -274,10 +274,10 @@ class MootoolsEngineHelperTest extends CakeTestCase {
|
|||
/**
|
||||
* test drop() method with the required drag option missing
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error_Warning
|
||||
* @return void
|
||||
*/
|
||||
public function testDropWithMissingOption() {
|
||||
$this->expectWarning();
|
||||
$this->Moo->get('#drop-me');
|
||||
$this->Moo->drop(array(
|
||||
'drop' => 'onDrop',
|
||||
|
|
|
@ -767,30 +767,30 @@ class ViewTest extends CakeTestCase {
|
|||
/**
|
||||
* Test elementInexistent method
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error_Notice
|
||||
* @return void
|
||||
*/
|
||||
public function testElementInexistent() {
|
||||
$this->expectNotice();
|
||||
$this->View->element('non_existent_element');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test elementInexistent2 method
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error_Notice
|
||||
* @return void
|
||||
*/
|
||||
public function testElementInexistent2() {
|
||||
$this->expectNotice();
|
||||
$this->View->element('TestPlugin.plugin_element', array(), array('plugin' => 'test_plugin'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test elementInexistent3 method
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error_Notice
|
||||
* @return void
|
||||
*/
|
||||
public function testElementInexistent3() {
|
||||
$this->expectNotice();
|
||||
$this->View->element('test_plugin.plugin_element');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue