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

Merge pull request #5923 from AlfredoRamos/ticket/16315

[ticket/16315] Remove Google+ profile field
This commit is contained in:
Marc Alexander
2020-04-21 20:50:01 +02:00
10 changed files with 82 additions and 178 deletions

View File

@@ -26,7 +26,6 @@ class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case
$form = $crawler->selectButton('Submit')->form(array(
'pf_phpbb_facebook' => 'phpbb',
'pf_phpbb_googleplus' => 'phpbb',
'pf_phpbb_location' => 'Bertie´s Empire',
'pf_phpbb_skype' => 'phpbb.skype.account',
'pf_phpbb_twitter' => 'phpbb_twitter',
@@ -40,7 +39,6 @@ class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case
$form = $crawler->selectButton('Submit')->form();
$this->assertEquals('phpbb', $form->get('pf_phpbb_facebook')->getValue());
$this->assertEquals('phpbb', $form->get('pf_phpbb_googleplus')->getValue());
$this->assertEquals('Bertie´s Empire', $form->get('pf_phpbb_location')->getValue());
$this->assertEquals('phpbb.skype.account', $form->get('pf_phpbb_skype')->getValue());
$this->assertEquals('phpbb_twitter', $form->get('pf_phpbb_twitter')->getValue());

View File

@@ -1,96 +0,0 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
class phpbb_profilefield_type_googleplus_test extends phpbb_test_case
{
protected $field;
public function setUp(): void
{
parent::setUp();
global $phpbb_root_path, $phpEx;
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime');
$user->add_lang('ucp');
$request = $this->createMock('\phpbb\request\request');
$template = $this->createMock('\phpbb\template\template');
$this->field = new \phpbb\profilefields\type\type_googleplus(
$request,
$template,
$user
);
}
public function get_profile_contact_value_data()
{
return array(
array(
'112010191010100',
array(),
'112010191010100',
'Field should return a numerical Google+ ID as is',
),
array(
'TestUsername',
array(),
'+TestUsername',
'Field should return a string Google+ ID with a + prefixed',
),
);
}
/**
* @dataProvider get_profile_contact_value_data
*/
public function test_get_profile_contact_value($value, $field_options, $expected, $description)
{
$default_field_options = array(
'field_type' => '\phpbb\profilefields\type\type_googleplus',
'field_name' => 'field',
'field_id' => 1,
'lang_id' => 1,
'lang_name' => 'field',
'field_required' => false,
'field_validation' => '[\w]+',
);
$field_options = array_merge($default_field_options, $field_options);
$this->assertSame($expected, $this->field->get_profile_contact_value($value, $field_options), $description);
}
public function data_validate_googleplus()
{
return array(
array('foobar', false),
array('2342340929304', false),
array('foo<bar', 'The field “googleplus” has invalid characters.'),
array('klkd.klkl', false),
array('kl+', 'The field “googleplus” has invalid characters.'),
array('foo=bar', 'The field “googleplus” has invalid characters.'),
array('..foo', 'The field “googleplus” has invalid characters.'),
array('foo..bar', 'The field “googleplus” has invalid characters.'),
);
}
/**
* @dataProvider data_validate_googleplus
*/
public function test_validate_googleplus($input, $expected)
{
$field_data = array_merge(array('lang_name' => 'googleplus'), $this->field->get_default_option_values());
$this->assertSame($expected, $this->field->validate_string_profile_field('string', $input, $field_data));
}
}