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