aboutsummaryrefslogtreecommitdiffstats
path: root/tests/profilefields
diff options
context:
space:
mode:
Diffstat (limited to 'tests/profilefields')
-rw-r--r--tests/profilefields/type_bool_test.php18
-rw-r--r--tests/profilefields/type_date_test.php8
-rw-r--r--tests/profilefields/type_dropdown_test.php18
-rw-r--r--tests/profilefields/type_googleplus_test.php6
-rw-r--r--tests/profilefields/type_int_test.php8
-rw-r--r--tests/profilefields/type_string_test.php8
-rw-r--r--tests/profilefields/type_url_test.php8
7 files changed, 39 insertions, 35 deletions
diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php
index 10239172c3..3e7cace288 100644
--- a/tests/profilefields/type_bool_test.php
+++ b/tests/profilefields/type_bool_test.php
@@ -23,19 +23,21 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
* @access public
* @return void
*/
- public function setUp()
+ public function setUp(): void
{
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,
diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php
index e0807b2f9b..b70aa60368 100644
--- a/tests/profilefields/type_date_test.php
+++ b/tests/profilefields/type_date_test.php
@@ -23,11 +23,11 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
* @access public
* @return null
*/
- public function setUp()
+ public function setUp(): void
{
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,
diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index ab02353fb9..738801d524 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -23,22 +23,24 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
* @access public
* @return null
*/
- public function setUp()
+ public function setUp(): void
{
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');
diff --git a/tests/profilefields/type_googleplus_test.php b/tests/profilefields/type_googleplus_test.php
index 9222362214..a5f934ea17 100644
--- a/tests/profilefields/type_googleplus_test.php
+++ b/tests/profilefields/type_googleplus_test.php
@@ -15,7 +15,7 @@ class phpbb_profilefield_type_googleplus_test extends phpbb_test_case
{
protected $field;
- public function setUp()
+ public function setUp(): void
{
parent::setUp();
@@ -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,
diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php
index 33f3f575c8..943f130835 100644
--- a/tests/profilefields/type_int_test.php
+++ b/tests/profilefields/type_int_test.php
@@ -22,11 +22,11 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
* @access public
* @return null
*/
- public function setUp()
+ public function setUp(): void
{
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,
diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
index 54bb406838..19bfbbc926 100644
--- a/tests/profilefields/type_string_test.php
+++ b/tests/profilefields/type_string_test.php
@@ -22,11 +22,11 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
* @access public
* @return null
*/
- public function setUp()
+ public function setUp(): void
{
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,
diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php
index 3bb5d52899..5ed5fb4c2f 100644
--- a/tests/profilefields/type_url_test.php
+++ b/tests/profilefields/type_url_test.php
@@ -26,13 +26,13 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
* @access public
* @return null
*/
- public function setUp()
+ public function setUp(): void
{
global $config, $request, $user, $cache, $phpbb_root_path, $phpEx;
$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,