aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShitiz Garg <mail@dragooon.net>2014-06-20 19:06:04 +0530
committerShitiz Garg <mail@dragooon.net>2014-06-21 03:31:45 +0530
commit30cce1ed49f89dc7e6d246c3bece236472e172d9 (patch)
tree8c0f363561a9329ef746fd7bbbfbcf81b5871e42
parent474dc577822e8c1937b35040de563cc81f0867cf (diff)
downloadforums-30cce1ed49f89dc7e6d246c3bece236472e172d9.tar
forums-30cce1ed49f89dc7e6d246c3bece236472e172d9.tar.gz
forums-30cce1ed49f89dc7e6d246c3bece236472e172d9.tar.bz2
forums-30cce1ed49f89dc7e6d246c3bece236472e172d9.tar.xz
forums-30cce1ed49f89dc7e6d246c3bece236472e172d9.zip
[ticket/12730] Add unit test for type_googleplus
PHPBB3-12730
-rw-r--r--tests/profilefields/type_googleplus_test.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/profilefields/type_googleplus_test.php b/tests/profilefields/type_googleplus_test.php
new file mode 100644
index 0000000000..167f9eb688
--- /dev/null
+++ b/tests/profilefields/type_googleplus_test.php
@@ -0,0 +1,62 @@
+<?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
+{
+ 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)
+ {
+ $user = $this->getMock('\phpbb\user');
+ $request = $this->getMock('\phpbb\request\request');
+ $template = $this->getMock('\phpbb\template\template');
+
+ $field = new \phpbb\profilefields\type\type_googleplus(
+ $request,
+ $template,
+ $user
+ );
+
+ $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' => '.*',
+ );
+ $field_options = array_merge($default_field_options, $field_options);
+
+ $this->assertSame($expected, $field->get_profile_contact_value($value, $field_options), $description);
+ }
+} \ No newline at end of file