Resolve warnings in PHPUnit tests due to deprecation
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
|
||||
namespace board3\portal\modules;
|
||||
|
||||
use PHPUnit\Framework\Exception;
|
||||
|
||||
require_once dirname(__FILE__) . '/../../mock/check_form_key.php';
|
||||
|
||||
class phpbb_unit_modules_welcome_test extends \board3\portal\tests\testframework\database_test_case
|
||||
@@ -197,7 +199,7 @@ class phpbb_unit_modules_welcome_test extends \board3\portal\tests\testframework
|
||||
$this->welcome = new \board3\portal\modules\welcome($this->config, $this->request, $this->template, $this->user, '', '');
|
||||
$this->request->overwrite('submit', true, \phpbb\request\request_interface::POST);
|
||||
$this->request->overwrite('welcome_message', 'foobar101');
|
||||
$this->setExpectedTriggerError(E_USER_WARNING);
|
||||
$this->expectException(Exception::class);
|
||||
$this->welcome->update_welcome('foobar', 5);
|
||||
}
|
||||
|
||||
@@ -207,8 +209,16 @@ class phpbb_unit_modules_welcome_test extends \board3\portal\tests\testframework
|
||||
$this->welcome = new \board3\portal\modules\welcome($this->config, $this->request, $this->template, $this->user, '', '');
|
||||
$this->request->overwrite('submit', true, \phpbb\request\request_interface::POST);
|
||||
$this->request->overwrite('welcome_message', '');
|
||||
$this->setExpectedTriggerError(version_compare(PHP_VERSION, '8', '>=') ? E_WARNING : E_USER_WARNING);
|
||||
$this->expectException(Exception::class);
|
||||
check_form_key::$form_key_valid = true;
|
||||
$this->welcome->update_welcome('foobar', 5);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('trigger_error'))
|
||||
{
|
||||
function trigger_error($input, $type = E_USER_NOTICE)
|
||||
{
|
||||
throw new Exception($input, $type);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user