1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/14972] Migrate from deprecated getMock() method to createMock()

PHPBB3-14972
This commit is contained in:
rxu
2017-03-19 21:46:20 +07:00
committed by Marc Alexander
parent cdf3aa27df
commit 42b7782927
70 changed files with 168 additions and 141 deletions

View File

@@ -27,15 +27,17 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
{
global $phpbb_root_path, $phpEx;
$user = $this->getMock('\phpbb\user', array(), array(
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
$db = $this->createMock('phpbb\\db\\driver\\driver');
$user = $this->createMock('\phpbb\user');
$user->expects($this->any())
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
$lang = $this->getMock('\phpbb\profilefields\lang_helper', array(), array(null, null));
$lang = $this->getMockBuilder('\phpbb\profilefields\lang_helper')
->setMethods(array('get_options_lang', 'is_set', 'get'))
->setConstructorArgs(array($db, LANG_TABLE))
->getMock();
$lang->expects($this->any())
->method('get_options_lang');
@@ -48,8 +50,8 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
->method('get')
->will($this->returnCallback(array($this, 'get')));
$request = $this->getMock('\phpbb\request\request');
$template = $this->getMock('\phpbb\template\template');
$request = $this->createMock('\phpbb\request\request');
$template = $this->createMock('\phpbb\template\template');
$this->cp = new \phpbb\profilefields\type\type_bool(
$lang,

View File

@@ -27,7 +27,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
{
global $phpbb_root_path, $phpEx;
$this->user = $this->getMock('\phpbb\user', array(), array(
$this->user = $this->createMock('\phpbb\user', array(), array(
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
@@ -45,8 +45,8 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
'DATE_FORMAT' => 'm/d/Y',
);
$request = $this->getMock('\phpbb\request\request');
$template = $this->getMock('\phpbb\template\template');
$request = $this->createMock('\phpbb\request\request');
$template = $this->createMock('\phpbb\template\template');
$this->cp = new \phpbb\profilefields\type\type_date(
$request,

View File

@@ -27,18 +27,20 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
{
global $phpbb_root_path, $phpEx;
$user = $this->getMock('\phpbb\user', array(), array(
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
$db = $this->createMock('phpbb\\db\\driver\\driver');
$user = $this->createMock('\phpbb\user');
$user->expects($this->any())
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
$request = $this->getMock('\phpbb\request\request');
$template = $this->getMock('\phpbb\template\template');
$request = $this->createMock('\phpbb\request\request');
$template = $this->createMock('\phpbb\template\template');
$lang = $this->getMock('\phpbb\profilefields\lang_helper', array(), array(null, null));
$lang = $this->getMockBuilder('\phpbb\profilefields\lang_helper')
->setMethods(array('get_options_lang', 'is_set', 'get'))
->setConstructorArgs(array($db, LANG_TABLE))
->getMock();
$lang->expects($this->any())
->method('get_options_lang');

View File

@@ -25,8 +25,8 @@ class phpbb_profilefield_type_googleplus_test extends phpbb_test_case
$lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime');
$user->add_lang('ucp');
$request = $this->getMock('\phpbb\request\request');
$template = $this->getMock('\phpbb\template\template');
$request = $this->createMock('\phpbb\request\request');
$template = $this->createMock('\phpbb\template\template');
$this->field = new \phpbb\profilefields\type\type_googleplus(
$request,

View File

@@ -26,7 +26,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
{
global $phpbb_root_path, $phpEx;
$user = $this->getMock('\phpbb\user', array(), array(
$user = $this->createMock('\phpbb\user', array(), array(
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
@@ -34,8 +34,8 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
$request = $this->getMock('\phpbb\request\request');
$template = $this->getMock('\phpbb\template\template');
$request = $this->createMock('\phpbb\request\request');
$template = $this->createMock('\phpbb\template\template');
$this->cp = new \phpbb\profilefields\type\type_int(
$request,

View File

@@ -26,7 +26,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
{
global $config, $request, $user, $cache, $phpbb_root_path, $phpEx;
$user = $this->getMock('\phpbb\user', array(), array(
$user = $this->createMock('\phpbb\user', array(), array(
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
@@ -36,8 +36,8 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
->will($this->returnCallback(array($this, 'return_callback_implode')));
$config = new \phpbb\config\config([]);
$request = $this->getMock('\phpbb\request\request');
$template = $this->getMock('\phpbb\template\template');
$request = $this->createMock('\phpbb\request\request');
$template = $this->createMock('\phpbb\template\template');
$this->cp = new \phpbb\profilefields\type\type_string(
$request,

View File

@@ -32,7 +32,7 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
$config = new \phpbb\config\config([]);
$cache = new phpbb_mock_cache;
$user = $this->getMock('\phpbb\user', array(), array(
$user = $this->createMock('\phpbb\user', array(), array(
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
@@ -40,8 +40,8 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
$request = $this->getMock('\phpbb\request\request');
$template = $this->getMock('\phpbb\template\template');
$request = $this->createMock('\phpbb\request\request');
$template = $this->createMock('\phpbb\template\template');
$this->cp = new \phpbb\profilefields\type\type_url(
$request,