From b1da3e9c7e3d637f13ae1939cb420340d9b4ea45 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 11 Jun 2014 13:20:46 +0530
Subject: [PATCH 01/28] [ticket/12514] Add test for "int" type custom profile
 field

PHPBB3-12514
---
 tests/profile/get_profile_value_test.php |  46 -------
 tests/profilefields/type_int_test.php    | 160 +++++++++++++++++++++++
 2 files changed, 160 insertions(+), 46 deletions(-)
 delete mode 100644 tests/profile/get_profile_value_test.php
 create mode 100644 tests/profilefields/type_int_test.php

diff --git a/tests/profile/get_profile_value_test.php b/tests/profile/get_profile_value_test.php
deleted file mode 100644
index 7a4a4ab5c2..0000000000
--- a/tests/profile/get_profile_value_test.php
+++ /dev/null
@@ -1,46 +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_profile_get_profile_value_test extends phpbb_test_case
-{
-	static public function get_profile_value_int_data()
-	{
-		return array(
-			array('\phpbb\profilefields\type\type_int',	'10',	true,	10),
-			array('\phpbb\profilefields\type\type_int',	'0',	true,	0),
-			array('\phpbb\profilefields\type\type_int',	'',		true,	0),
-			array('\phpbb\profilefields\type\type_int',	null,	true,	0),
-			array('\phpbb\profilefields\type\type_int',	'10',	false,	10),
-			array('\phpbb\profilefields\type\type_int',	'0',	false,	0),
-			array('\phpbb\profilefields\type\type_int',	'',		false,	null),
-			array('\phpbb\profilefields\type\type_int',	null,	false,	null),
-		);
-	}
-
-	/**
-	* @dataProvider get_profile_value_int_data
-	*/
-	public function test_get_profile_value_int($type, $value, $show_novalue, $expected)
-	{
-		$cp = new $type(
-			$this->getMock('\phpbb\request\request'),
-			$this->getMock('\phpbb\template\template'),
-			$this->getMock('\phpbb\user')
-		);
-
-		$this->assertSame($expected, $cp->get_profile_value($value, array(
-			'field_type'			=> $type,
-			'field_show_novalue'	=> $show_novalue,
-		)));
-	}
-}
diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php
new file mode 100644
index 0000000000..eb414faced
--- /dev/null
+++ b/tests/profilefields/type_int_test.php
@@ -0,0 +1,160 @@
+<?php
+/**
+ * @package testing
+ * @copyright (c) 2014 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+class phpbb_profilefield_type_int_test extends phpbb_test_case
+{
+    protected $cp;
+    protected $field_options;
+
+    /**
+     * Sets up basic test objects
+     *
+     * @access public
+     * @return void
+     */
+    public function setUp()
+    {
+        $user = $this->getMock('\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');
+
+        $this->cp = new \phpbb\profilefields\type\type_int(
+            $request,
+            $template,
+            $user
+        );
+
+        $this->field_options = array(
+            'field_type'     => '\phpbb\profilefields\type\type_int',
+            'field_name' 	 => 'field',
+            'field_id'	 	 => 1,
+            'lang_id'	 	 => 1,
+            'lang_name'      => 'field',
+            'field_required' => false,
+        );
+    }
+
+    public function get_profile_value_data()
+    {
+        return array(
+            array(
+                    '10',
+                    array('field_show_novalue' => true),
+                    10,
+                    'Field should output integer value of given input',
+            ),
+            array(
+                    '0',
+                    array('field_show_novalue' => true),
+                    0,
+                    'Field should output integer value of given input',
+            ),
+            array(
+                    '',
+                    array('field_show_novalue' => true),
+                    0,
+                    'Field should translate empty value to 0 as integer',
+                    false,
+            ),
+            array(
+                    null,
+                    array('field_show_novalue' => true),
+                    0,
+                    'Field should translate null value to 0 as integer',
+            ),
+            array(
+                    '10',
+                    array('field_show_novalue' => false),
+                    10,
+                    'Field should output integer value of given input',
+            ),
+            array(
+                    '0',
+                    array('field_show_novalue' => false),
+                    0,
+                    'Field should output integer value of given input',
+            ),
+            array(
+                    '',
+                    array('field_show_novalue' => false),
+                    null,
+                    'Field should leave empty value as is',
+            ),
+            array(
+                    null,
+                    array('field_show_novalue' => false),
+                    null,
+                    'Field should leave empty value as is',
+            ),
+        );
+    }
+
+    /**
+     * @dataProvider get_profile_value_data
+     */
+    public function test_get_profile_value($value, $field_options, $expected, $description)
+    {
+        $field_options = array_merge($this->field_options, $field_options);
+
+        $result = $this->cp->get_profile_value($value, $field_options);
+
+        $this->assertSame($expected, $result, $description);
+    }
+
+    public function get_validate_profile_field_data()
+    {
+        return array(
+            array(
+                    '124',
+                    array('field_minlen' => 2, 'field_maxlen' => 4, 'field_required' => true),
+                    false,
+                    'Field should accept input of correct length',
+            ),
+            array(
+                    '556476',
+                    array('field_maxlen' => 4, 'field_required' => true),
+                    'FIELD_TOO_LARGE-4-field',
+                    'Field should reject value of greater length',
+            ),
+            array(
+                    '9',
+                    array('field_minlen' => 2, 'field_required' => true),
+                    'FIELD_TOO_SMALL-2-field',
+                    'Field should reject value which is less than defined minlength',
+            ),
+
+            array(
+                    '',
+                    array('field_required' => true),
+                    'FIELD_REQUIRED-field',
+                    'Field should reject value for being empty',
+            ),
+        );
+    }
+
+    /**
+     * @dataProvider get_validate_profile_field_data
+     */
+    public function test_validate_profile_field($value, $field_options, $expected, $description)
+    {
+        $field_options = array_merge($this->field_options, $field_options);
+
+        $result = $this->cp->validate_profile_field($value, $field_options);
+
+        $this->assertSame($expected, $result, $description);
+    }
+
+    public function return_callback_implode()
+    {
+        return implode('-', func_get_args());
+    }
+}

From 16f6edc02ae00b9466bfc819aa0afae26b076a4b Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Mon, 26 May 2014 01:37:00 +0530
Subject: [PATCH 02/28] [ticket/12514] Add unit test for type_string and
 type_string_common field types

PHPBB3-12514
---
 tests/profilefields/type_string_test.php | 179 +++++++++++++++++++++++
 1 file changed, 179 insertions(+)
 create mode 100644 tests/profilefields/type_string_test.php

diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
new file mode 100644
index 0000000000..8fadf4fcac
--- /dev/null
+++ b/tests/profilefields/type_string_test.php
@@ -0,0 +1,179 @@
+<?php
+/**
+ * @package testing
+ * @copyright (c) 2014 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+class phpbb_profilefield_type_string_test extends phpbb_test_case
+{
+    protected $cp;
+    protected $field_options;
+
+    /**
+     * Sets up basic test objects
+     *
+     * @access public
+     * @return void
+     */
+    public function setUp()
+    {
+        global $request, $user, $cache;
+
+        require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+        require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
+        require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
+
+        $user = $this->getMock('\phpbb\user');
+        $cache = new phpbb_mock_cache;
+        $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');
+
+        $this->cp = new \phpbb\profilefields\type\type_string(
+            $request,
+            $template,
+            $user
+        );
+
+        $this->field_options = array(
+            'field_type'       => '\phpbb\profilefields\type\type_string',
+            'field_name' 	   => 'field',
+            'field_id'	 	   => 1,
+            'lang_id'	 	   => 1,
+            'lang_name'        => 'field',
+            'field_required'   => false,
+            'field_validation' => '.*',
+        );
+    }
+
+    public function get_validate_profile_field_data()
+    {
+        return array(
+            array(
+                    '',
+                    array('field_required' => true),
+                    'FIELD_REQUIRED-field',
+                    'Field should not accept empty values for required fields',
+            ),
+            array(
+                    'tas',
+                    array('field_minlen' => 2, 'field_maxlen' => 5),
+                    false,
+                    'Field should accept value of correct length',
+            ),
+            array(
+                    't',
+                    array('field_minlen' => 2, 'field_maxlen' => 5),
+                    'FIELD_TOO_SHORT-2-field',
+                    'Field should reject value of incorrect length',
+            ),
+            array(
+                    'this is a long string',
+                    array('field_minlen' => 2, 'field_maxlen' => 5),
+                    'FIELD_TOO_LONG-5-field',
+                    'Field should reject value of incorrect length',
+            ),
+            array(
+                    'H3110',
+                    array('field_validation' => '[0-9]+'),
+                    'FIELD_INVALID_CHARS_NUMBERS_ONLY-field',
+                    'Required field should reject characters in a numbers-only field',
+            ),
+            array(
+                    '&lt;&gt;&quot;&amp;%&amp;&gt;&lt;&gt;',
+                    array('field_maxlen' => 10, 'field_minlen' => 2),
+                    false,
+                    'Optional field should accept html entities',
+            ),
+            array(
+                    'ö ä ü ß',
+                    array(),
+                    false,
+                    'Required field should accept UTF-8 string',
+            ),
+            array(
+                    'This ö ä string has to b',
+                    array('field_maxlen' => 10),
+                    'FIELD_TOO_LONG-10-field',
+                    'Required field should reject an UTF-8 string which is too long',
+            ),
+            array(
+                    'ö äö äö ä',
+                    array('field_validation' => '[\w]+'),
+                    'FIELD_INVALID_CHARS_ALPHA_ONLY-field',
+                    'Required field should reject UTF-8 in alpha only field',
+            ),
+            array(
+                    'Hello',
+                    array('field_validation' => '[\w]+'),
+                    false,
+                    'Required field should accept a characters only field',
+            ),
+        );
+    }
+
+    /**
+     * @dataProvider get_validate_profile_field_data
+     */
+    public function test_validate_profile_field($value, $field_options, $expected, $description)
+    {
+        $field_options = array_merge($this->field_options, $field_options);
+
+        $result = $this->cp->validate_profile_field($value, $field_options);
+
+        $this->assertSame($expected, $result, $description);
+    }
+
+    public function get_profile_value_data()
+    {
+        return array(
+            array(
+                    'test',
+                    array('field_show_novalue' => true),
+                    'test',
+                    'Field should output the given value',
+            ),
+            array(
+                    'test',
+                    array('field_show_novalue' => false),
+                    'test',
+                    'Field should output the given value',
+            ),
+            array(
+                    '',
+                    array('field_show_novalue' => true),
+                    '',
+                    'Field should output nothing for empty value',
+            ),
+            array(
+                    '',
+                    array('field_show_novalue' => false),
+                    null,
+                    'Field should simply output null for empty vlaue',
+            ),
+        );
+    }
+
+
+    /**
+     * @dataProvider get_profile_value_data
+     */
+    public function test_get_profile_value($value, $field_options, $expected, $description)
+    {
+        $field_options = array_merge($this->field_options, $field_options);
+
+        $result = $this->cp->get_profile_value($value, $field_options);
+
+        $this->assertSame($expected, $result, $description);
+    }
+
+    public function return_callback_implode()
+    {
+        return implode('-', func_get_args());
+    }
+}

From 3cb04756bfc430a9bcd157076f62ca401d4a20a7 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Mon, 26 May 2014 01:38:05 +0530
Subject: [PATCH 03/28] [ticket/12514] custom_string_test is no longer required

PHPBB3-12514
---
 tests/profile/custom_string_test.php | 120 ---------------------------
 1 file changed, 120 deletions(-)
 delete mode 100644 tests/profile/custom_string_test.php

diff --git a/tests/profile/custom_string_test.php b/tests/profile/custom_string_test.php
deleted file mode 100644
index 9e45d05ae3..0000000000
--- a/tests/profile/custom_string_test.php
+++ /dev/null
@@ -1,120 +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.
-*
-*/
-
-require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
-
-class phpbb_profile_custom_string_test extends phpbb_database_test_case
-{
-	public function getDataSet()
-	{
-		return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/profile_fields.xml');
-	}
-
-	static public function string_fields()
-	{
-		return array(
-			// note, there is an offset of 1 between option_id (0-indexed)
-			// in the database and values (1-indexed) to avoid problems with
-			// transmitting 0 in an HTML form
-			//    required, value, validation, expected, description
-			array(
-					1,
-					'H3110',
-					'[0-9]+',
-					'FIELD_INVALID_CHARS_NUMBERS_ONLY-field',
-					'Required field should reject characters in a numbers-only field',
-			),
-			array(
-					1,
-					'This string is too long',
-					'.*',
-					'FIELD_TOO_LONG-10-field',
-					'Required field should reject a field too long',
-			),
-			array(
-					0,
-					'&lt;&gt;&quot;&amp;%&amp;&gt;&lt;&gt;',
-					'.*',
-					false,
-					'Optional field should accept html entities',
-			),
-			array(
-					1,
-					'ö ä ü ß',
-					'.*',
-					false,
-					'Required field should accept UTF-8 string',
-			),
-			array(
-					1,
-					'This ö ä string has to b',
-					'.*',
-					'FIELD_TOO_LONG-10-field',
-					'Required field should reject an UTF-8 string which is too long',
-			),
-			array(
-					1,
-					'ö äö äö ä',
-					'[\w]+',
-					'FIELD_INVALID_CHARS_ALPHA_ONLY-field',
-					'Required field should reject UTF-8 in alpha only field',
-			),
-			array(
-					1,
-					'Hello',
-					'[\w]+',
-					false,
-					'Required field should accept a characters only field',
-			),
-		);
-	}
-
-	/**
-	* @dataProvider string_fields
-	*/
-	public function test_string_validate($field_required, $field_value, $field_validation, $expected, $description)
-	{
-		$db = $this->new_dbal();
-
-		$field_data = array(
-			'field_id'          => 1,
-			'lang_id'			=> 1,
-			'lang_name'			=> 'field',
-			'field_novalue'		=> 1,
-			'field_required'    => $field_required,
-			'field_maxlen'      => 10,
-			'field_validation'  => $field_validation,
-		);
-		$user = $this->getMock('\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');
-
-		$cp = new \phpbb\profilefields\type\type_string(
-			$request,
-			$template,
-			$user
-		);
-		$result = $cp->validate_profile_field($field_value, $field_data);
-
-		$this->assertEquals($expected, $result, $description);
-	}
-
-	public function return_callback_implode()
-	{
-		return implode('-', func_get_args());
-	}
-}

From cee46f2405ab9a91c9631dd77de0c6f5cc8f916f Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Mon, 9 Jun 2014 15:11:10 +0530
Subject: [PATCH 04/28] [ticket/12514] Add unit test for drop down type custom
 profile field

PHPBB3-12514
---
 tests/profilefields/type_dropdown_test.php | 177 +++++++++++++++++++++
 1 file changed, 177 insertions(+)
 create mode 100644 tests/profilefields/type_dropdown_test.php

diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
new file mode 100644
index 0000000000..c17780d6d6
--- /dev/null
+++ b/tests/profilefields/type_dropdown_test.php
@@ -0,0 +1,177 @@
+<?php
+/**
+ * @package testing
+ * @copyright (c) 2014 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
+{
+    protected $cp;
+    protected $field_options = array();
+    protected $dropdown_options = array();
+
+    /**
+     * Sets up basic test objects
+     *
+     * @access public
+     * @return void
+     */
+    public function setUp()
+    {
+        global $request, $user, $cache, $db, $table_prefix;
+
+        require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+        require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
+        require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
+
+        $user = $this->getMock('\phpbb\user');
+        $cache = new phpbb_mock_cache;
+        $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');
+
+        $lang = $this->getMock('\phpbb\profilefields\lang_helper', array(), array($db, $table_prefix . 'profile_fields_lang'));
+
+        $lang->expects($this->any())
+             ->method('get_options_lang');
+
+        $lang->expects($this->any())
+             ->method('is_set')
+             ->will($this->returnCallback(array($this, 'is_set_callback')));
+
+        $lang->expects($this->any())
+             ->method('get')
+             ->will($this->returnCallback(array($this, 'get')));
+
+        $this->cp = new \phpbb\profilefields\type\type_dropdown(
+            $lang,
+            $request,
+            $template,
+            $user
+        );
+
+        $this->field_options = array(
+            'field_type'       => '\phpbb\profilefields\type\type_dropdown',
+            'field_name' 	   => 'field',
+            'field_id'	 	   => 1,
+            'lang_id'	 	   => 1,
+            'lang_name'        => 'field',
+            'field_required'   => false,
+            'field_validation' => '.*',
+            'field_novalue'    => 0,
+        );
+
+        $this->dropdown_options = array(
+            0 => '<No Value>',
+            1 => 'Option 1',
+            2 => 'Option 2',
+            3 => 'Option 3',
+            4 => 'Option 4',
+        );
+    }
+
+    public function get_validate_profile_field_data()
+    {
+        return array(
+                array(
+                    7,
+                    array(),
+                    'FIELD_INVALID_VALUE-field',
+                    'Invalid value should throw error',
+                ),
+                array(
+                    2,
+                    array(),
+                    false,
+                    'Valid value should not throw error'
+                ),
+                array(
+                    0,
+                    array(),
+                    false,
+                    'Empty value should be acceptible',
+                ),
+                array(
+                    0,
+                    array('field_required' => true),
+                    'FIELD_REQUIRED-field',
+                    'Required field should not accept empty value',
+                ),
+        );
+    }
+
+    /**
+     * @dataProvider get_validate_profile_field_data
+     */
+    public function test_validate_profile_field($value, $field_options, $expected, $description)
+    {
+        $field_options = array_merge($this->field_options, $field_options);
+
+        $result = $this->cp->validate_profile_field($value, $field_options);
+
+        $this->assertSame($expected, $result, $description);
+    }
+
+    public function get_profile_value_data()
+    {
+        return array(
+            array(
+                1,
+                array('field_show_novalue' => true),
+                'Option 1',
+                'Field should output the given value',
+            ),
+            array(
+                4,
+                array('field_show_novalue' => false),
+                'Option 4',
+                'Field should output the given value',
+            ),
+            array(
+                '',
+                array('field_show_novalue' => true),
+                '<No Value>',
+                'Field should output nothing for empty value',
+            ),
+            array(
+                '',
+                array('field_show_novalue' => false),
+                null,
+                'Field should simply output null for empty value',
+            ),
+        );
+    }
+
+
+    /**
+     * @dataProvider get_profile_value_data
+     */
+    public function test_get_profile_value($value, $field_options, $expected, $description)
+    {
+        $field_options = array_merge($this->field_options, $field_options);
+
+        $result = $this->cp->get_profile_value($value, $field_options);
+
+        $this->assertSame($expected, $result, $description);
+    }
+
+    public function is_set_callback($field_id, $lang_id, $field_value)
+    {
+        return isset($this->dropdown_options[$field_value]);
+    }
+
+    public function get($field_id, $lang_id, $field_value)
+    {
+        return $this->dropdown_options[$field_value];
+    }
+
+    public function return_callback_implode()
+    {
+        return implode('-', func_get_args());
+    }
+}
\ No newline at end of file

From 86754cf572909b61fb2cd3e29cef42e2a8079dd7 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Mon, 9 Jun 2014 15:14:26 +0530
Subject: [PATCH 05/28] [ticket/12514] Use @return null instead of @return void

PHPBB3-12514
---
 tests/profilefields/type_dropdown_test.php | 2 +-
 tests/profilefields/type_int_test.php      | 2 +-
 tests/profilefields/type_string_test.php   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index c17780d6d6..0e1fb101b7 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -16,7 +16,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
      * Sets up basic test objects
      *
      * @access public
-     * @return void
+     * @return null
      */
     public function setUp()
     {
diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php
index eb414faced..d3ce27691a 100644
--- a/tests/profilefields/type_int_test.php
+++ b/tests/profilefields/type_int_test.php
@@ -15,7 +15,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
      * Sets up basic test objects
      *
      * @access public
-     * @return void
+     * @return null
      */
     public function setUp()
     {
diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
index 8fadf4fcac..869f20b94f 100644
--- a/tests/profilefields/type_string_test.php
+++ b/tests/profilefields/type_string_test.php
@@ -15,7 +15,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
      * Sets up basic test objects
      *
      * @access public
-     * @return void
+     * @return null
      */
     public function setUp()
     {

From e8a6fee7434d6dab6a5f84c04b934ab41f797efd Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Mon, 9 Jun 2014 15:15:42 +0530
Subject: [PATCH 06/28] [ticket/12514] Move requires to the top of the files

PHPBB3-12514
---
 tests/profilefields/type_dropdown_test.php | 10 +++++-----
 tests/profilefields/type_string_test.php   |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index 0e1fb101b7..d71ee78497 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -6,6 +6,10 @@
  *
  */
 
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
+
 class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
 {
     protected $cp;
@@ -20,11 +24,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
      */
     public function setUp()
     {
-        global $request, $user, $cache, $db, $table_prefix;
-
-        require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
-        require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
-        require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
+        global $request, $user, $cache, $db, $table_prefix;Ω
 
         $user = $this->getMock('\phpbb\user');
         $cache = new phpbb_mock_cache;
diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
index 869f20b94f..f1423d59d9 100644
--- a/tests/profilefields/type_string_test.php
+++ b/tests/profilefields/type_string_test.php
@@ -6,6 +6,10 @@
  *
  */
 
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
+
 class phpbb_profilefield_type_string_test extends phpbb_test_case
 {
     protected $cp;
@@ -21,10 +25,6 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
     {
         global $request, $user, $cache;
 
-        require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
-        require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
-        require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
-
         $user = $this->getMock('\phpbb\user');
         $cache = new phpbb_mock_cache;
         $user->expects($this->any())

From 87729c81fcbada0d696b02b9bbdc2940ddd157f8 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Mon, 9 Jun 2014 15:18:39 +0530
Subject: [PATCH 07/28] [ticket/12514] Add newline at the end of file for
 type_dropdown_test.php

PHPBB3-12514
---
 tests/profilefields/type_dropdown_test.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index d71ee78497..a029d0f29f 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -174,4 +174,4 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
     {
         return implode('-', func_get_args());
     }
-}
\ No newline at end of file
+}

From e08a4eaf9a9b20705f143ede4850dc2a74408b9d Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Mon, 9 Jun 2014 19:57:26 +0530
Subject: [PATCH 08/28] [ticket/12514] Cleanup for type_dropdown_test.php

PHPBB3-12514
---
 tests/profilefields/type_dropdown_test.php | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index a029d0f29f..4bfd0443fd 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -6,10 +6,6 @@
  *
  */
 
-require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
-
 class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
 {
     protected $cp;
@@ -24,10 +20,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
      */
     public function setUp()
     {
-        global $request, $user, $cache, $db, $table_prefix;Ω
-
         $user = $this->getMock('\phpbb\user');
-        $cache = new phpbb_mock_cache;
         $user->expects($this->any())
             ->method('lang')
             ->will($this->returnCallback(array($this, 'return_callback_implode')));
@@ -35,7 +28,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
         $request = $this->getMock('\phpbb\request\request');
         $template = $this->getMock('\phpbb\template\template');
 
-        $lang = $this->getMock('\phpbb\profilefields\lang_helper', array(), array($db, $table_prefix . 'profile_fields_lang'));
+        $lang = $this->getMock('\phpbb\profilefields\lang_helper', array(), array(null, null));
 
         $lang->expects($this->any())
              ->method('get_options_lang');

From 6534e13c33cb1a0fcff935adb4e7b26d453af182 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 11 Jun 2014 01:53:40 +0530
Subject: [PATCH 09/28] [ticket/12514] Add unit test for type_bool custom
 profile field

PHPBB3-12514
---
 tests/profilefields/type_bool_test.php | 143 +++++++++++++++++++++++++
 1 file changed, 143 insertions(+)
 create mode 100644 tests/profilefields/type_bool_test.php

diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php
new file mode 100644
index 0000000000..86cee66f5a
--- /dev/null
+++ b/tests/profilefields/type_bool_test.php
@@ -0,0 +1,143 @@
+<?php
+/**
+ * @package testing
+ * @copyright (c) 2014 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+class phpbb_profilefield_type_bool_test extends phpbb_test_case
+{
+    protected $cp;
+    protected $field_options = array();
+    protected $options = array();
+
+    /**
+     * Sets up basic test objects
+     *
+     * @access public
+     * @return void
+     */
+    public function setUp()
+    {
+        $user = $this->getMock('\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->expects($this->any())
+            ->method('get_options_lang');
+
+        $lang->expects($this->any())
+            ->method('is_set')
+            ->will($this->returnCallback(array($this, 'is_set_callback')));
+
+        $lang->expects($this->any())
+            ->method('get')
+            ->will($this->returnCallback(array($this, 'get')));
+
+        $request = $this->getMock('\phpbb\request\request');
+        $template = $this->getMock('\phpbb\template\template');
+
+        $this->cp = new \phpbb\profilefields\type\type_bool(
+            $lang,
+            $request,
+            $template,
+            $user
+        );
+
+        $this->field_options = array(
+            'field_type'       => '\phpbb\profilefields\type\type_bool',
+            'field_name' 	   => 'field',
+            'field_id'	 	   => 1,
+            'lang_id'	 	   => 1,
+            'lang_name'        => 'field',
+            'field_required'   => false,
+            'field_default_value' => 1,
+            'field_length' => 1,
+        );
+
+        $this->options = array(
+            0 => 'Yes',
+            1 => 'No',
+        );
+    }
+
+    public function get_validate_profile_field_data()
+    {
+        return array(
+                array(
+                    false,
+                    array('field_required' => true),
+                    'FIELD_REQUIRED-field',
+                    'Field should not accept empty values for required fields',
+                ),
+        );
+    }
+
+    /**
+     * @dataProvider get_validate_profile_field_data
+     */
+    public function test_validate_profile_field($value, $field_options, $expected, $description)
+    {
+        $field_options = array_merge($this->field_options, $field_options);
+
+        $result = $this->cp->validate_profile_field($value, $field_options);
+
+        $this->assertSame($expected, $result, $description);
+    }
+
+    public function get_profile_value_data()
+    {
+        return array(
+                array(
+                    false,
+                    array('field_show_novalue' => true),
+                    'No',
+                    'Field should output the default value',
+                ),
+                array(
+                    false,
+                    array('field_show_novalue' => false, 'field_length' => 2),
+                    null,
+                    'Field should not show anything for empty value',
+                ),
+                array(
+                    0,
+                    array(),
+                    'Yes',
+                    'Field should show the set value',
+                ),
+        );
+    }
+
+
+    /**
+     * @dataProvider get_profile_value_data
+     */
+    public function test_get_profile_value($value, $field_options, $expected, $description)
+    {
+        $field_options = array_merge($this->field_options, $field_options);
+
+        $result = $this->cp->get_profile_value($value, $field_options);
+
+        $this->assertSame($expected, $result, $description);
+    }
+
+    public function is_set_callback($field_id, $lang_id, $field_value)
+    {
+        return isset($this->options[$field_value]);
+    }
+
+    public function get($field_id, $lang_id, $field_value)
+    {
+        return $this->options[$field_value];
+    }
+
+    public function return_callback_implode()
+    {
+        return implode('-', func_get_args());
+    }
+}

From 8be079bd66b3c51c2a36b5e5175765c2d41fc552 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 11 Jun 2014 02:13:45 +0530
Subject: [PATCH 10/28] [ticket/12514] Add unit test for type_date custom
 profile field

PHPBB3-12514
---
 tests/profilefields/type_date_test.php | 151 +++++++++++++++++++++++++
 1 file changed, 151 insertions(+)
 create mode 100644 tests/profilefields/type_date_test.php

diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php
new file mode 100644
index 0000000000..fb3759ef5e
--- /dev/null
+++ b/tests/profilefields/type_date_test.php
@@ -0,0 +1,151 @@
+<?php
+/**
+ * @package testing
+ * @copyright (c) 2014 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+class phpbb_profilefield_type_date_test extends phpbb_test_case
+{
+    protected $cp;
+    protected $field_options;
+    protected $user;
+
+    /**
+     * Sets up basic test objects
+     *
+     * @access public
+     * @return null
+     */
+    public function setUp()
+    {
+        $this->user = $this->getMock('\phpbb\user');
+        $this->user->expects($this->any())
+            ->method('lang')
+            ->will($this->returnCallback(array($this, 'return_callback_implode')));
+
+        $this->user->expects($this->any())
+            ->method('create_datetime')
+            ->will($this->returnCallback(array($this, 'create_datetime_callback')));
+
+        $this->user->timezone = new DateTimeZone('UTC');
+        $this->user->lang = array(
+            'datetime' => array(),
+            'DATE_FORMAT' => 'm/d/Y',
+        );
+
+        $request = $this->getMock('\phpbb\request\request');
+        $template = $this->getMock('\phpbb\template\template');
+
+        $this->cp = new \phpbb\profilefields\type\type_date(
+            $request,
+            $template,
+            $this->user
+        );
+
+        $this->field_options = array(
+            'field_type'     => '\phpbb\profilefields\type\type_date',
+            'field_name' 	 => 'field',
+            'field_id'	 	 => 1,
+            'lang_id'	 	 => 1,
+            'lang_name'      => 'field',
+            'field_required' => false,
+        );
+    }
+
+    public function get_profile_value_data()
+    {
+        return array(
+            array(
+                '01-01-2009',
+                array('field_show_novalue' => true),
+                '01/01/2009',
+                'Field should output the correctly formatted date',
+            ),
+            array(
+                null,
+                array('field_show_novalue' => false),
+                null,
+                'Field should leave empty value as is',
+            ),
+            array(
+                'None',
+                array('field_show_novalue' => true),
+                'None',
+                'Field should leave invalid value as is',
+            ),
+        );
+    }
+
+    /**
+     * @dataProvider get_profile_value_data
+     */
+    public function test_get_profile_value($value, $field_options, $expected, $description)
+    {
+        $field_options = array_merge($this->field_options, $field_options);
+
+        $result = $this->cp->get_profile_value($value, $field_options);
+
+        $this->assertSame($expected, $result, $description);
+    }
+
+    public function get_validate_profile_field_data()
+    {
+        return array(
+            array(
+                '',
+                array('field_required' => true),
+                'FIELD_REQUIRED-field',
+                'Field should reject value for being empty',
+            ),
+            array(
+                '0125',
+                array('field_required' => true),
+                'FIELD_REQUIRED-field',
+                'Field should reject value for being invalid',
+            ),
+            array(
+                '01-01-2012',
+                array(),
+                false,
+                'Field should accept a valid value',
+            ),
+            array(
+                '40-05-2009',
+                array(),
+                'FIELD_INVALID_DATE-field',
+                'Field should reject value for being invalid',
+            ),
+            array(
+                '12-30-2012',
+                array(),
+                'FIELD_INVALID_DATE-field',
+                'Field should reject value for being invalid',
+            ),
+        );
+    }
+
+    /**
+     * @dataProvider get_validate_profile_field_data
+     */
+    public function test_validate_profile_field($value, $field_options, $expected, $description)
+    {
+        $field_options = array_merge($this->field_options, $field_options);
+
+        $result = $this->cp->validate_profile_field($value, $field_options);
+
+        $this->assertSame($expected, $result, $description);
+    }
+
+    public function return_callback_implode()
+    {
+        return implode('-', func_get_args());
+    }
+
+    public function create_datetime_callback($time = 'now', \DateTimeZone $timezone = null)
+    {
+        $timezone = $timezone ?: $this->user->timezone;
+        return new \phpbb\datetime($this->user, $time, $timezone);
+    }
+}

From 165d7c4b98bccb3142db4643329dabbd05cfc69a Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 11 Jun 2014 02:33:35 +0530
Subject: [PATCH 11/28] [ticket/12514] Add unit test for type_url custom
 profile field

PHPBB3-12514
---
 tests/profilefields/type_url_test.php | 106 ++++++++++++++++++++++++++
 1 file changed, 106 insertions(+)
 create mode 100644 tests/profilefields/type_url_test.php

diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php
new file mode 100644
index 0000000000..08cb33e60f
--- /dev/null
+++ b/tests/profilefields/type_url_test.php
@@ -0,0 +1,106 @@
+<?php
+/**
+ * @package testing
+ * @copyright (c) 2014 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+
+class phpbb_profilefield_type_url_test extends phpbb_test_case
+{
+    protected $cp;
+    protected $field_options;
+
+    /**
+     * Sets up basic test objects
+     *
+     * @access public
+     * @return null
+     */
+    public function setUp()
+    {
+        $user = $this->getMock('\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');
+
+        $this->cp = new \phpbb\profilefields\type\type_url(
+            $request,
+            $template,
+            $user
+        );
+
+        $this->field_options = array(
+            'field_type'     => '\phpbb\profilefields\type\type_url',
+            'field_name' 	 => 'field',
+            'field_id'	 	 => 1,
+            'lang_id'	 	 => 1,
+            'lang_name'      => 'field',
+            'field_required' => false,
+        );
+    }
+
+    public function get_validate_profile_field_data()
+    {
+        return array(
+            array(
+                '',
+                array('field_required' => true),
+                'FIELD_INVALID_URL-field',
+                'Field should reject empty field that is required',
+            ),
+            array(
+                'invalidURL',
+                array(),
+                'FIELD_INVALID_URL-field',
+                'Field should reject invalid input',
+            ),
+            array(
+                'http://onetwthree.aol.io',
+                array(),
+                false,
+                'Field should accept valid URL',
+            ),
+            array(
+                'http://example.com/index.html?param1=test&param2=awesome',
+                array(),
+                false,
+                'Field should accept valid URL',
+            ),
+            array(
+                'http://example.com/index.html/test/path?document=get',
+                array(),
+                false,
+                'Field should accept valid URL',
+            ),
+            array(
+                'http://example.com/index.html/test/path?document[]=DocType%20test&document[]=AnotherDoc',
+                array(),
+                false,
+                'Field should accept valid URL having multi value parameters',
+            ),
+        );
+    }
+
+    /**
+     * @dataProvider get_validate_profile_field_data
+     */
+    public function test_validate_profile_field($value, $field_options, $expected, $description)
+    {
+        $field_options = array_merge($this->field_options, $field_options);
+
+        $result = $this->cp->validate_profile_field($value, $field_options);
+
+        $this->assertSame($expected, $result, $description);
+    }
+
+    public function return_callback_implode()
+    {
+        return implode('-', func_get_args());
+    }
+}

From 995690e19208cdbb699ce3dde29baa243fd3c613 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 11 Jun 2014 02:35:51 +0530
Subject: [PATCH 12/28] [ticket/12514] Multi value GET parameters are invalid
 for phpBB

PHPBB3-12514
---
 tests/profilefields/type_url_test.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php
index 08cb33e60f..d53566effc 100644
--- a/tests/profilefields/type_url_test.php
+++ b/tests/profilefields/type_url_test.php
@@ -81,8 +81,8 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
             array(
                 'http://example.com/index.html/test/path?document[]=DocType%20test&document[]=AnotherDoc',
                 array(),
-                false,
-                'Field should accept valid URL having multi value parameters',
+                'FIELD_INVALID_URL-field',
+                'Field should reject invalid URL having multi value parameters',
             ),
         );
     }

From 2fc5c51d9ac883d4fe77afbe94846fde5ce0a7f4 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Sat, 14 Jun 2014 14:27:23 +0530
Subject: [PATCH 13/28] [ticket/12514] Fix type_int_test to correctly respect
 boundaries

PHPBB3-12514
---
 tests/profilefields/type_int_test.php | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php
index d3ce27691a..7189a4dda2 100644
--- a/tests/profilefields/type_int_test.php
+++ b/tests/profilefields/type_int_test.php
@@ -114,29 +114,22 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
     {
         return array(
             array(
-                    '124',
-                    array('field_minlen' => 2, 'field_maxlen' => 4, 'field_required' => true),
+                    '15',
+                    array('field_minlen' => 10, 'field_maxlen' => 20, 'field_required' => true),
                     false,
-                    'Field should accept input of correct length',
+                    'Field should accept input of correct boundaries',
             ),
             array(
                     '556476',
-                    array('field_maxlen' => 4, 'field_required' => true),
-                    'FIELD_TOO_LARGE-4-field',
-                    'Field should reject value of greater length',
+                    array('field_maxlen' => 50000, 'field_required' => true),
+                    'FIELD_TOO_LARGE-50000-field',
+                    'Field should reject value of greater value than max',
             ),
             array(
                     '9',
-                    array('field_minlen' => 2, 'field_required' => true),
-                    'FIELD_TOO_SMALL-2-field',
-                    'Field should reject value which is less than defined minlength',
-            ),
-
-            array(
-                    '',
-                    array('field_required' => true),
-                    'FIELD_REQUIRED-field',
-                    'Field should reject value for being empty',
+                    array('field_minlen' => 10, 'field_required' => true),
+                    'FIELD_TOO_SMALL-10-field',
+                    'Field should reject value which is less than defined minimum',
             ),
         );
     }

From 70db69cb8c4f1495291054db4c81785e3c95d866 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Sat, 14 Jun 2014 14:31:55 +0530
Subject: [PATCH 14/28] [ticket/12514] Remove tests/profiles as they're no
 longer required

PHPBB3-12514
---
 tests/profile/custom_test.php             | 75 -----------------------
 tests/profile/fixtures/profile_fields.xml | 31 ----------
 2 files changed, 106 deletions(-)
 delete mode 100644 tests/profile/custom_test.php
 delete mode 100644 tests/profile/fixtures/profile_fields.xml

diff --git a/tests/profile/custom_test.php b/tests/profile/custom_test.php
deleted file mode 100644
index 8570e8e6ee..0000000000
--- a/tests/profile/custom_test.php
+++ /dev/null
@@ -1,75 +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_profile_custom_test extends phpbb_database_test_case
-{
-	public function getDataSet()
-	{
-		return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/profile_fields.xml');
-	}
-
-	static public function dropdown_fields()
-	{
-		return array(
-			// note, there is an offset of 1 between option_id (0-indexed)
-			// in the database and values (1-indexed) to avoid problems with
-			// transmitting 0 in an HTML form
-			//    required, value, expected
-			array(1,        '0',   'FIELD_INVALID_VALUE-field',	'Required field should throw error for out-of-range value'),
-			array(1,        '1',   'FIELD_REQUIRED-field',		'Required field should throw error for default value'),
-			array(1,        '2',   false,						'Required field should accept non-default value'),
-			array(0,        '0',   'FIELD_INVALID_VALUE-field', 'Optional field should throw error for out-of-range value'),
-			array(0,        '1',   false,						'Optional field should accept default value'),
-			array(0,        '2',   false,						'Optional field should accept non-default value'),
-		);
-	}
-
-	/**
-	* @dataProvider dropdown_fields
-	*/
-	public function test_dropdown_validate($field_required, $field_value, $expected, $description)
-	{
-		global $db, $table_prefix;
-		$db = $this->new_dbal();
-
-		$field_data = array(
-			'field_id'			=> 1,
-			'lang_id'			=> 1,
-			'lang_name'			=> 'field',
-			'field_novalue'		=> 1,
-			'field_required'	=> $field_required,
-		);
-		$user = $this->getMock('\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');
-
-		$cp = new \phpbb\profilefields\type\type_dropdown(
-			new \phpbb\profilefields\lang_helper($db, $table_prefix . 'profile_fields_lang'),
-			$request,
-			$template,
-			$user
-		);
-		$result = $cp->validate_profile_field($field_value, $field_data);
-
-		$this->assertEquals($expected, $result, $description);
-	}
-
-	public function return_callback_implode()
-	{
-		return implode('-', func_get_args());
-	}
-}
diff --git a/tests/profile/fixtures/profile_fields.xml b/tests/profile/fixtures/profile_fields.xml
deleted file mode 100644
index e0c260bbf5..0000000000
--- a/tests/profile/fixtures/profile_fields.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<dataset>
-	<table name="phpbb_profile_fields_lang">
-		<column>field_id</column>
-		<column>lang_id</column>
-		<column>option_id</column>
-		<column>field_type</column>
-		<column>lang_value</column>
-		<row>
-			<value>1</value>
-			<value>1</value>
-			<value>0</value>
-			<value>profilefields.type.dropdown</value>
-			<value>Default Option</value>
-		</row>
-		<row>
-			<value>1</value>
-			<value>1</value>
-			<value>1</value>
-			<value>profilefields.type.dropdown</value>
-			<value>First Alternative</value>
-		</row>
-		<row>
-			<value>1</value>
-			<value>1</value>
-			<value>2</value>
-			<value>profilefields.type.dropdown</value>
-			<value>Third Alternative</value>
-		</row>
-	</table>
-</dataset>

From d38816fc146112566fdeed99069c37506ab78999 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Tue, 17 Jun 2014 15:09:07 +0530
Subject: [PATCH 15/28] [ticket/12514] Minor fault in type_bool_test.php

Had a double new line before get_profile_value_data

PHPBB3-12514
---
 tests/profilefields/type_bool_test.php | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php
index 86cee66f5a..1773718a38 100644
--- a/tests/profilefields/type_bool_test.php
+++ b/tests/profilefields/type_bool_test.php
@@ -113,7 +113,6 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
         );
     }
 
-
     /**
      * @dataProvider get_profile_value_data
      */

From 80d9e4b2e319b8a1b93c876e5304a6ed7b50b1d8 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 18 Jun 2014 01:05:57 +0530
Subject: [PATCH 16/28] [ticket/12514] Add a few more validation cases for
 type_string_test

PHPBB3-12514
---
 tests/profilefields/type_string_test.php | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
index f1423d59d9..17adf1f5f4 100644
--- a/tests/profilefields/type_string_test.php
+++ b/tests/profilefields/type_string_test.php
@@ -60,6 +60,30 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
                     'FIELD_REQUIRED-field',
                     'Field should not accept empty values for required fields',
             ),
+            array(
+                    null,
+                    array('field_required' => true),
+                    'FIELD_REQUIRED-field',
+                    'Field should not accept empty values for required field',
+            ),
+            array(
+                    0,
+                    array('field_required' => true),
+                    false,
+                    'Field should accept a non-empty input',
+            ),
+            array(
+                    'false',
+                    array('field_required' => true),
+                    false,
+                    'Field should accept a non-empty input',
+            ),
+            array(
+                    10,
+                    array('field_required' => true),
+                    false,
+                    'Field should accept a non-empty input',
+            ),
             array(
                     'tas',
                     array('field_minlen' => 2, 'field_maxlen' => 5),

From c15ab1e87e93ab1b345b30cd8f1cc181b19aa4aa Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 18 Jun 2014 01:11:21 +0530
Subject: [PATCH 17/28] [ticket/12514] Remove get_ prefix from data providers

PHPBB3-12514
---
 tests/profilefields/type_bool_test.php     | 8 ++++----
 tests/profilefields/type_date_test.php     | 8 ++++----
 tests/profilefields/type_dropdown_test.php | 8 ++++----
 tests/profilefields/type_int_test.php      | 8 ++++----
 tests/profilefields/type_string_test.php   | 8 ++++----
 tests/profilefields/type_url_test.php      | 4 ++--
 6 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php
index 1773718a38..c86abba195 100644
--- a/tests/profilefields/type_bool_test.php
+++ b/tests/profilefields/type_bool_test.php
@@ -65,7 +65,7 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
         );
     }
 
-    public function get_validate_profile_field_data()
+    public function validate_profile_field_data()
     {
         return array(
                 array(
@@ -78,7 +78,7 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
     }
 
     /**
-     * @dataProvider get_validate_profile_field_data
+     * @dataProvider validate_profile_field_data
      */
     public function test_validate_profile_field($value, $field_options, $expected, $description)
     {
@@ -89,7 +89,7 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
         $this->assertSame($expected, $result, $description);
     }
 
-    public function get_profile_value_data()
+    public function profile_value_data()
     {
         return array(
                 array(
@@ -114,7 +114,7 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
     }
 
     /**
-     * @dataProvider get_profile_value_data
+     * @dataProvider profile_value_data
      */
     public function test_get_profile_value($value, $field_options, $expected, $description)
     {
diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php
index fb3759ef5e..f694197008 100644
--- a/tests/profilefields/type_date_test.php
+++ b/tests/profilefields/type_date_test.php
@@ -54,7 +54,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
         );
     }
 
-    public function get_profile_value_data()
+    public function profile_value_data()
     {
         return array(
             array(
@@ -79,7 +79,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
     }
 
     /**
-     * @dataProvider get_profile_value_data
+     * @dataProvider profile_value_data
      */
     public function test_get_profile_value($value, $field_options, $expected, $description)
     {
@@ -90,7 +90,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
         $this->assertSame($expected, $result, $description);
     }
 
-    public function get_validate_profile_field_data()
+    public function validate_profile_field_data()
     {
         return array(
             array(
@@ -127,7 +127,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
     }
 
     /**
-     * @dataProvider get_validate_profile_field_data
+     * @dataProvider validate_profile_field_data
      */
     public function test_validate_profile_field($value, $field_options, $expected, $description)
     {
diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index 4bfd0443fd..80b1aa25b1 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -68,7 +68,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
         );
     }
 
-    public function get_validate_profile_field_data()
+    public function validate_profile_field_data()
     {
         return array(
                 array(
@@ -99,7 +99,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
     }
 
     /**
-     * @dataProvider get_validate_profile_field_data
+     * @dataProvider validate_profile_field_data
      */
     public function test_validate_profile_field($value, $field_options, $expected, $description)
     {
@@ -110,7 +110,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
         $this->assertSame($expected, $result, $description);
     }
 
-    public function get_profile_value_data()
+    public function profile_value_data()
     {
         return array(
             array(
@@ -142,7 +142,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
 
 
     /**
-     * @dataProvider get_profile_value_data
+     * @dataProvider profile_value_data
      */
     public function test_get_profile_value($value, $field_options, $expected, $description)
     {
diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php
index 7189a4dda2..4c5b4f121b 100644
--- a/tests/profilefields/type_int_test.php
+++ b/tests/profilefields/type_int_test.php
@@ -43,7 +43,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
         );
     }
 
-    public function get_profile_value_data()
+    public function profile_value_data()
     {
         return array(
             array(
@@ -99,7 +99,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
     }
 
     /**
-     * @dataProvider get_profile_value_data
+     * @dataProvider profile_value_data
      */
     public function test_get_profile_value($value, $field_options, $expected, $description)
     {
@@ -110,7 +110,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
         $this->assertSame($expected, $result, $description);
     }
 
-    public function get_validate_profile_field_data()
+    public function validate_profile_field_data()
     {
         return array(
             array(
@@ -135,7 +135,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
     }
 
     /**
-     * @dataProvider get_validate_profile_field_data
+     * @dataProvider validate_profile_field_data
      */
     public function test_validate_profile_field($value, $field_options, $expected, $description)
     {
diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
index 17adf1f5f4..38bd771ac2 100644
--- a/tests/profilefields/type_string_test.php
+++ b/tests/profilefields/type_string_test.php
@@ -51,7 +51,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
         );
     }
 
-    public function get_validate_profile_field_data()
+    public function validate_profile_field_data()
     {
         return array(
             array(
@@ -142,7 +142,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
     }
 
     /**
-     * @dataProvider get_validate_profile_field_data
+     * @dataProvider validate_profile_field_data
      */
     public function test_validate_profile_field($value, $field_options, $expected, $description)
     {
@@ -153,7 +153,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
         $this->assertSame($expected, $result, $description);
     }
 
-    public function get_profile_value_data()
+    public function profile_value_data()
     {
         return array(
             array(
@@ -185,7 +185,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
 
 
     /**
-     * @dataProvider get_profile_value_data
+     * @dataProvider profile_value_data
      */
     public function test_get_profile_value($value, $field_options, $expected, $description)
     {
diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php
index d53566effc..831e678595 100644
--- a/tests/profilefields/type_url_test.php
+++ b/tests/profilefields/type_url_test.php
@@ -45,7 +45,7 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
         );
     }
 
-    public function get_validate_profile_field_data()
+    public function validate_profile_field_data()
     {
         return array(
             array(
@@ -88,7 +88,7 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
     }
 
     /**
-     * @dataProvider get_validate_profile_field_data
+     * @dataProvider validate_profile_field_data
      */
     public function test_validate_profile_field($value, $field_options, $expected, $description)
     {

From 5fc51fd7b71a0c6e1bc7e56133237cf4ca323575 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 18 Jun 2014 01:13:28 +0530
Subject: [PATCH 18/28] [ticket/12514] Update file headers to represent the
 current format

PHPBB3-12514
---
 tests/profilefields/type_bool_test.php     | 11 ++++++++---
 tests/profilefields/type_date_test.php     | 11 ++++++++---
 tests/profilefields/type_dropdown_test.php | 11 ++++++++---
 tests/profilefields/type_int_test.php      | 11 ++++++++---
 tests/profilefields/type_string_test.php   | 11 ++++++++---
 tests/profilefields/type_url_test.php      | 11 ++++++++---
 6 files changed, 48 insertions(+), 18 deletions(-)

diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php
index c86abba195..ca4d13ccf7 100644
--- a/tests/profilefields/type_bool_test.php
+++ b/tests/profilefields/type_bool_test.php
@@ -1,8 +1,13 @@
 <?php
 /**
- * @package testing
- * @copyright (c) 2014 phpBB Group
- * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ * 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.
  *
  */
 
diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php
index f694197008..256fd61e09 100644
--- a/tests/profilefields/type_date_test.php
+++ b/tests/profilefields/type_date_test.php
@@ -1,8 +1,13 @@
 <?php
 /**
- * @package testing
- * @copyright (c) 2014 phpBB Group
- * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ * 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.
  *
  */
 
diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index 80b1aa25b1..0c440cf143 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -1,8 +1,13 @@
 <?php
 /**
- * @package testing
- * @copyright (c) 2014 phpBB Group
- * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ * 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.
  *
  */
 
diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php
index 4c5b4f121b..4cfc8a06e2 100644
--- a/tests/profilefields/type_int_test.php
+++ b/tests/profilefields/type_int_test.php
@@ -1,8 +1,13 @@
 <?php
 /**
- * @package testing
- * @copyright (c) 2014 phpBB Group
- * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ * 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.
  *
  */
 
diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
index 38bd771ac2..ae8f908bb5 100644
--- a/tests/profilefields/type_string_test.php
+++ b/tests/profilefields/type_string_test.php
@@ -1,8 +1,13 @@
 <?php
 /**
- * @package testing
- * @copyright (c) 2014 phpBB Group
- * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ * 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.
  *
  */
 
diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php
index 831e678595..48f9cf8f38 100644
--- a/tests/profilefields/type_url_test.php
+++ b/tests/profilefields/type_url_test.php
@@ -1,8 +1,13 @@
 <?php
 /**
- * @package testing
- * @copyright (c) 2014 phpBB Group
- * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ * 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.
  *
  */
 

From 934db6ded1eb4f0d2e1dc1897318672d6b940fe9 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 18 Jun 2014 01:17:10 +0530
Subject: [PATCH 19/28] [ticket/12514] Use generic domain name for URL test

PHPBB3-12514
---
 tests/profilefields/type_url_test.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php
index 48f9cf8f38..c49bf6afd0 100644
--- a/tests/profilefields/type_url_test.php
+++ b/tests/profilefields/type_url_test.php
@@ -66,7 +66,7 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
                 'Field should reject invalid input',
             ),
             array(
-                'http://onetwthree.aol.io',
+                'http://onetwothree.example.io',
                 array(),
                 false,
                 'Field should accept valid URL',

From aee20bcf0c94f37656b3d8bf213649a4ca702df6 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 18 Jun 2014 01:25:04 +0530
Subject: [PATCH 20/28] [ticket/12514] Remove spaces in header blocks

PHPBB3-12514
---
 tests/profilefields/type_bool_test.php     | 20 ++++++++++----------
 tests/profilefields/type_date_test.php     | 20 ++++++++++----------
 tests/profilefields/type_dropdown_test.php | 20 ++++++++++----------
 tests/profilefields/type_int_test.php      | 20 ++++++++++----------
 tests/profilefields/type_string_test.php   | 20 ++++++++++----------
 tests/profilefields/type_url_test.php      | 20 ++++++++++----------
 6 files changed, 60 insertions(+), 60 deletions(-)

diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php
index ca4d13ccf7..0b1f2b8a30 100644
--- a/tests/profilefields/type_bool_test.php
+++ b/tests/profilefields/type_bool_test.php
@@ -1,15 +1,15 @@
 <?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.
- *
- */
+*
+* 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_bool_test extends phpbb_test_case
 {
diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php
index 256fd61e09..013d9d9082 100644
--- a/tests/profilefields/type_date_test.php
+++ b/tests/profilefields/type_date_test.php
@@ -1,15 +1,15 @@
 <?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.
- *
- */
+*
+* 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_date_test extends phpbb_test_case
 {
diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index 0c440cf143..dad843086d 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -1,15 +1,15 @@
 <?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.
- *
- */
+*
+* 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_dropdown_test extends phpbb_test_case
 {
diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php
index 4cfc8a06e2..a12909722a 100644
--- a/tests/profilefields/type_int_test.php
+++ b/tests/profilefields/type_int_test.php
@@ -1,15 +1,15 @@
 <?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.
- *
- */
+*
+* 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_int_test extends phpbb_test_case
 {
diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
index ae8f908bb5..8e24b7a3f0 100644
--- a/tests/profilefields/type_string_test.php
+++ b/tests/profilefields/type_string_test.php
@@ -1,15 +1,15 @@
 <?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.
- *
- */
+*
+* 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.
+*
+*/
 
 require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
 require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php
index c49bf6afd0..fab86dc2c1 100644
--- a/tests/profilefields/type_url_test.php
+++ b/tests/profilefields/type_url_test.php
@@ -1,15 +1,15 @@
 <?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.
- *
- */
+*
+* 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.
+*
+*/
 
 require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
 

From f549a6ce9f4758d7e4fff588e407203d6a38fb88 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 18 Jun 2014 01:40:40 +0530
Subject: [PATCH 21/28] [ticket/12514] Add a few more tests for type_date

PHPBB3-12514
---
 tests/profilefields/type_date_test.php | 36 ++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php
index 013d9d9082..b0ac114942 100644
--- a/tests/profilefields/type_date_test.php
+++ b/tests/profilefields/type_date_test.php
@@ -128,6 +128,42 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
                 'FIELD_INVALID_DATE-field',
                 'Field should reject value for being invalid',
             ),
+            array(
+                'string',
+                array(),
+                false,
+                'Field should reject value for being invalid',
+            ),
+            array(
+                'string',
+                array('field_required' => true),
+                'FIELD_REQUIRED-field',
+                'Field should reject value for being invalid',
+            ),
+            array(
+                100,
+                array(),
+                false,
+                'Field should reject value for being invalid',
+            ),
+            array(
+                100,
+                array('field_required' => true),
+                'FIELD_REQUIRED-field',
+                'Field should reject value for being invalid',
+            ),
+            array(
+                null,
+                array('field_required' => true),
+                'FIELD_REQUIRED-field',
+                'Field should reject value for being empty',
+            ),
+            array(
+                true,
+                array('field_required' => true),
+                'FIELD_REQUIRED-field',
+                'Field should reject value for being empty',
+            )
         );
     }
 

From e820143e87da13be621bcfb5c9cf65fa83389715 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 18 Jun 2014 01:45:08 +0530
Subject: [PATCH 22/28] [ticket/12514] Fix some formatting for tests

PHPBB3-12514
---
 tests/profilefields/type_bool_test.php     |  16 +--
 tests/profilefields/type_date_test.php     | 114 ++++++++++-----------
 tests/profilefields/type_dropdown_test.php |  48 ++++-----
 tests/profilefields/type_url_test.php      |  46 ++++-----
 4 files changed, 112 insertions(+), 112 deletions(-)

diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php
index 0b1f2b8a30..91852f210b 100644
--- a/tests/profilefields/type_bool_test.php
+++ b/tests/profilefields/type_bool_test.php
@@ -73,12 +73,12 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
     public function validate_profile_field_data()
     {
         return array(
-                array(
+            array(
                     false,
                     array('field_required' => true),
                     'FIELD_REQUIRED-field',
                     'Field should not accept empty values for required fields',
-                ),
+            ),
         );
     }
 
@@ -97,24 +97,24 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
     public function profile_value_data()
     {
         return array(
-                array(
+            array(
                     false,
                     array('field_show_novalue' => true),
                     'No',
                     'Field should output the default value',
-                ),
-                array(
+            ),
+            array(
                     false,
                     array('field_show_novalue' => false, 'field_length' => 2),
                     null,
                     'Field should not show anything for empty value',
-                ),
-                array(
+            ),
+            array(
                     0,
                     array(),
                     'Yes',
                     'Field should show the set value',
-                ),
+            ),
         );
     }
 
diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php
index b0ac114942..05bf72d0b9 100644
--- a/tests/profilefields/type_date_test.php
+++ b/tests/profilefields/type_date_test.php
@@ -63,22 +63,22 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
     {
         return array(
             array(
-                '01-01-2009',
-                array('field_show_novalue' => true),
-                '01/01/2009',
-                'Field should output the correctly formatted date',
+                    '01-01-2009',
+                    array('field_show_novalue' => true),
+                    '01/01/2009',
+                    'Field should output the correctly formatted date',
             ),
             array(
-                null,
-                array('field_show_novalue' => false),
-                null,
-                'Field should leave empty value as is',
+                    null,
+                    array('field_show_novalue' => false),
+                    null,
+                    'Field should leave empty value as is',
             ),
             array(
-                'None',
-                array('field_show_novalue' => true),
-                'None',
-                'Field should leave invalid value as is',
+                    'None',
+                    array('field_show_novalue' => true),
+                    'None',
+                    'Field should leave invalid value as is',
             ),
         );
     }
@@ -99,71 +99,71 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
     {
         return array(
             array(
-                '',
-                array('field_required' => true),
-                'FIELD_REQUIRED-field',
-                'Field should reject value for being empty',
+                    '',
+                    array('field_required' => true),
+                    'FIELD_REQUIRED-field',
+                    'Field should reject value for being empty',
             ),
             array(
-                '0125',
-                array('field_required' => true),
-                'FIELD_REQUIRED-field',
-                'Field should reject value for being invalid',
+                    '0125',
+                    array('field_required' => true),
+                    'FIELD_REQUIRED-field',
+                    'Field should reject value for being invalid',
             ),
             array(
-                '01-01-2012',
-                array(),
-                false,
-                'Field should accept a valid value',
+                    '01-01-2012',
+                    array(),
+                    false,
+                    'Field should accept a valid value',
             ),
             array(
-                '40-05-2009',
-                array(),
-                'FIELD_INVALID_DATE-field',
-                'Field should reject value for being invalid',
+                    '40-05-2009',
+                    array(),
+                    'FIELD_INVALID_DATE-field',
+                    'Field should reject value for being invalid',
             ),
             array(
-                '12-30-2012',
-                array(),
-                'FIELD_INVALID_DATE-field',
-                'Field should reject value for being invalid',
+                    '12-30-2012',
+                    array(),
+                    'FIELD_INVALID_DATE-field',
+                    'Field should reject value for being invalid',
             ),
             array(
-                'string',
-                array(),
-                false,
-                'Field should reject value for being invalid',
+                    'string',
+                    array(),
+                    false,
+                    'Field should reject value for being invalid',
             ),
             array(
-                'string',
-                array('field_required' => true),
-                'FIELD_REQUIRED-field',
-                'Field should reject value for being invalid',
+                    'string',
+                    array('field_required' => true),
+                    'FIELD_REQUIRED-field',
+                    'Field should reject value for being invalid',
             ),
             array(
-                100,
-                array(),
-                false,
-                'Field should reject value for being invalid',
+                    100,
+                    array(),
+                    false,
+                    'Field should reject value for being invalid',
             ),
             array(
-                100,
-                array('field_required' => true),
-                'FIELD_REQUIRED-field',
-                'Field should reject value for being invalid',
+                    100,
+                    array('field_required' => true),
+                    'FIELD_REQUIRED-field',
+                    'Field should reject value for being invalid',
             ),
             array(
-                null,
-                array('field_required' => true),
-                'FIELD_REQUIRED-field',
-                'Field should reject value for being empty',
+                    null,
+                    array('field_required' => true),
+                    'FIELD_REQUIRED-field',
+                    'Field should reject value for being empty',
             ),
             array(
-                true,
-                array('field_required' => true),
-                'FIELD_REQUIRED-field',
-                'Field should reject value for being empty',
-            )
+                    true,
+                    array('field_required' => true),
+                    'FIELD_REQUIRED-field',
+                    'Field should reject value for being empty',
+            ),
         );
     }
 
diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index dad843086d..ddc34f221f 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -76,30 +76,30 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
     public function validate_profile_field_data()
     {
         return array(
-                array(
+            array(
                     7,
                     array(),
                     'FIELD_INVALID_VALUE-field',
                     'Invalid value should throw error',
-                ),
-                array(
+            ),
+            array(
                     2,
                     array(),
                     false,
                     'Valid value should not throw error'
-                ),
-                array(
+            ),
+            array(
                     0,
                     array(),
                     false,
                     'Empty value should be acceptible',
-                ),
-                array(
+            ),
+            array(
                     0,
                     array('field_required' => true),
                     'FIELD_REQUIRED-field',
                     'Required field should not accept empty value',
-                ),
+            ),
         );
     }
 
@@ -119,28 +119,28 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
     {
         return array(
             array(
-                1,
-                array('field_show_novalue' => true),
-                'Option 1',
-                'Field should output the given value',
+                    1,
+                    array('field_show_novalue' => true),
+                    'Option 1',
+                    'Field should output the given value',
             ),
             array(
-                4,
-                array('field_show_novalue' => false),
-                'Option 4',
-                'Field should output the given value',
+                    4,
+                    array('field_show_novalue' => false),
+                    'Option 4',
+                    'Field should output the given value',
             ),
             array(
-                '',
-                array('field_show_novalue' => true),
-                '<No Value>',
-                'Field should output nothing for empty value',
+                    '',
+                    array('field_show_novalue' => true),
+                    '<No Value>',
+                    'Field should output nothing for empty value',
             ),
             array(
-                '',
-                array('field_show_novalue' => false),
-                null,
-                'Field should simply output null for empty value',
+                    '',
+                    array('field_show_novalue' => false),
+                    null,
+                    'Field should simply output null for empty value',
             ),
         );
     }
diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php
index fab86dc2c1..68ae0f6b7d 100644
--- a/tests/profilefields/type_url_test.php
+++ b/tests/profilefields/type_url_test.php
@@ -55,39 +55,39 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
         return array(
             array(
                 '',
-                array('field_required' => true),
-                'FIELD_INVALID_URL-field',
-                'Field should reject empty field that is required',
+                    array('field_required' => true),
+                    'FIELD_INVALID_URL-field',
+                    'Field should reject empty field that is required',
             ),
             array(
-                'invalidURL',
-                array(),
-                'FIELD_INVALID_URL-field',
-                'Field should reject invalid input',
+                    'invalidURL',
+                    array(),
+                    'FIELD_INVALID_URL-field',
+                    'Field should reject invalid input',
             ),
             array(
-                'http://onetwothree.example.io',
-                array(),
-                false,
-                'Field should accept valid URL',
+                    'http://onetwothree.example.io',
+                    array(),
+                    false,
+                    'Field should accept valid URL',
             ),
             array(
-                'http://example.com/index.html?param1=test&param2=awesome',
-                array(),
-                false,
-                'Field should accept valid URL',
+                    'http://example.com/index.html?param1=test&param2=awesome',
+                    array(),
+                    false,
+                    'Field should accept valid URL',
             ),
             array(
-                'http://example.com/index.html/test/path?document=get',
-                array(),
-                false,
-                'Field should accept valid URL',
+                    'http://example.com/index.html/test/path?document=get',
+                    array(),
+                    false,
+                    'Field should accept valid URL',
             ),
             array(
-                'http://example.com/index.html/test/path?document[]=DocType%20test&document[]=AnotherDoc',
-                array(),
-                'FIELD_INVALID_URL-field',
-                'Field should reject invalid URL having multi value parameters',
+                    'http://example.com/index.html/test/path?document[]=DocType%20test&document[]=AnotherDoc',
+                    array(),
+                    'FIELD_INVALID_URL-field',
+                    'Field should reject invalid URL having multi value parameters',
             ),
         );
     }

From 566f76a6b082c9e0a85a1e7d8995f65b8a121b8c Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 18 Jun 2014 14:37:13 +0530
Subject: [PATCH 23/28] [ticket/12514] Add a few additional tests for type_int

PHPBB3-12514
---
 tests/profilefields/type_int_test.php | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php
index a12909722a..11278e8f52 100644
--- a/tests/profilefields/type_int_test.php
+++ b/tests/profilefields/type_int_test.php
@@ -136,6 +136,24 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
                     'FIELD_TOO_SMALL-10-field',
                     'Field should reject value which is less than defined minimum',
             ),
+            array(
+                    true,
+                    array('field_maxlen' => 20),
+                    false,
+                    'Field should accept correct boolean value',
+            ),
+            array(
+                    'string',
+                    array('field_maxlen' => 10, 'field_required' => true),
+                    false,
+                    'Field should accept correct string value',
+            ),
+            array(
+                    null,
+                    array('field_minlen' => 1, 'field_maxlen' => 10, 'field_required' => true),
+                    'FIELD_TOO_SMALL-1-field',
+                    'Field should not accept an empty value',
+            ),
         );
     }
 

From 9f478de2ca65b2775624d244df12f4e26bb5d208 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 18 Jun 2014 15:34:06 +0530
Subject: [PATCH 24/28] [ticket/12514] Add a few additional tests for
 type_dropdown

PHPBB3-12514
---
 tests/profilefields/type_dropdown_test.php | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index ddc34f221f..ec68f0e77e 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -82,6 +82,18 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
                     'FIELD_INVALID_VALUE-field',
                     'Invalid value should throw error',
             ),
+            array(
+                    true,
+                    array('field_required' => true),
+                    false,
+                    'Boolean would evaluate to 1 and hence correct value',
+            ),
+            array(
+                    'string',
+                    array('field_required' => true),
+                    'FIELD_REQUIRED-field',
+                    'String should be rejected for value',
+            ),
             array(
                     2,
                     array(),

From d1f517ad65bd65ae6d1517feb104facbb14cab41 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 18 Jun 2014 17:54:15 +0530
Subject: [PATCH 25/28] [ticket/12514] Convert spaces to tabs

PHPBB3-12514
---
 tests/profilefields/type_bool_test.php     | 222 ++++++-------
 tests/profilefields/type_date_test.php     | 320 +++++++++----------
 tests/profilefields/type_dropdown_test.php | 300 +++++++++---------
 tests/profilefields/type_int_test.php      | 294 ++++++++---------
 tests/profilefields/type_string_test.php   | 346 ++++++++++-----------
 tests/profilefields/type_url_test.php      | 168 +++++-----
 6 files changed, 825 insertions(+), 825 deletions(-)

diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php
index 91852f210b..87c9d7c96f 100644
--- a/tests/profilefields/type_bool_test.php
+++ b/tests/profilefields/type_bool_test.php
@@ -13,135 +13,135 @@
 
 class phpbb_profilefield_type_bool_test extends phpbb_test_case
 {
-    protected $cp;
-    protected $field_options = array();
-    protected $options = array();
+	protected $cp;
+	protected $field_options = array();
+	protected $options = array();
 
-    /**
-     * Sets up basic test objects
-     *
-     * @access public
-     * @return void
-     */
-    public function setUp()
-    {
-        $user = $this->getMock('\phpbb\user');
-        $user->expects($this->any())
-            ->method('lang')
-            ->will($this->returnCallback(array($this, 'return_callback_implode')));
+	/**
+	 * Sets up basic test objects
+	 *
+	 * @access public
+	 * @return void
+	 */
+	public function setUp()
+	{
+		$user = $this->getMock('\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->getMock('\phpbb\profilefields\lang_helper', array(), array(null, null));
 
-        $lang->expects($this->any())
-            ->method('get_options_lang');
+		$lang->expects($this->any())
+			->method('get_options_lang');
 
-        $lang->expects($this->any())
-            ->method('is_set')
-            ->will($this->returnCallback(array($this, 'is_set_callback')));
+		$lang->expects($this->any())
+			->method('is_set')
+			->will($this->returnCallback(array($this, 'is_set_callback')));
 
-        $lang->expects($this->any())
-            ->method('get')
-            ->will($this->returnCallback(array($this, 'get')));
+		$lang->expects($this->any())
+			->method('get')
+			->will($this->returnCallback(array($this, 'get')));
 
-        $request = $this->getMock('\phpbb\request\request');
-        $template = $this->getMock('\phpbb\template\template');
+		$request = $this->getMock('\phpbb\request\request');
+		$template = $this->getMock('\phpbb\template\template');
 
-        $this->cp = new \phpbb\profilefields\type\type_bool(
-            $lang,
-            $request,
-            $template,
-            $user
-        );
+		$this->cp = new \phpbb\profilefields\type\type_bool(
+			$lang,
+			$request,
+			$template,
+			$user
+		);
 
-        $this->field_options = array(
-            'field_type'       => '\phpbb\profilefields\type\type_bool',
-            'field_name' 	   => 'field',
-            'field_id'	 	   => 1,
-            'lang_id'	 	   => 1,
-            'lang_name'        => 'field',
-            'field_required'   => false,
-            'field_default_value' => 1,
-            'field_length' => 1,
-        );
+		$this->field_options = array(
+			'field_type'       => '\phpbb\profilefields\type\type_bool',
+			'field_name' 	   => 'field',
+			'field_id'	 	   => 1,
+			'lang_id'	 	   => 1,
+			'lang_name'        => 'field',
+			'field_required'   => false,
+			'field_default_value' => 1,
+			'field_length' => 1,
+		);
 
-        $this->options = array(
-            0 => 'Yes',
-            1 => 'No',
-        );
-    }
+		$this->options = array(
+			0 => 'Yes',
+			1 => 'No',
+		);
+	}
 
-    public function validate_profile_field_data()
-    {
-        return array(
-            array(
-                    false,
-                    array('field_required' => true),
-                    'FIELD_REQUIRED-field',
-                    'Field should not accept empty values for required fields',
-            ),
-        );
-    }
+	public function validate_profile_field_data()
+	{
+		return array(
+			array(
+					false,
+					array('field_required' => true),
+					'FIELD_REQUIRED-field',
+					'Field should not accept empty values for required fields',
+			),
+		);
+	}
 
-    /**
-     * @dataProvider validate_profile_field_data
-     */
-    public function test_validate_profile_field($value, $field_options, $expected, $description)
-    {
-        $field_options = array_merge($this->field_options, $field_options);
+	/**
+	 * @dataProvider validate_profile_field_data
+	 */
+	public function test_validate_profile_field($value, $field_options, $expected, $description)
+	{
+		$field_options = array_merge($this->field_options, $field_options);
 
-        $result = $this->cp->validate_profile_field($value, $field_options);
+		$result = $this->cp->validate_profile_field($value, $field_options);
 
-        $this->assertSame($expected, $result, $description);
-    }
+		$this->assertSame($expected, $result, $description);
+	}
 
-    public function profile_value_data()
-    {
-        return array(
-            array(
-                    false,
-                    array('field_show_novalue' => true),
-                    'No',
-                    'Field should output the default value',
-            ),
-            array(
-                    false,
-                    array('field_show_novalue' => false, 'field_length' => 2),
-                    null,
-                    'Field should not show anything for empty value',
-            ),
-            array(
-                    0,
-                    array(),
-                    'Yes',
-                    'Field should show the set value',
-            ),
-        );
-    }
+	public function profile_value_data()
+	{
+		return array(
+			array(
+					false,
+					array('field_show_novalue' => true),
+					'No',
+					'Field should output the default value',
+			),
+			array(
+					false,
+					array('field_show_novalue' => false, 'field_length' => 2),
+					null,
+					'Field should not show anything for empty value',
+			),
+			array(
+					0,
+					array(),
+					'Yes',
+					'Field should show the set value',
+			),
+		);
+	}
 
-    /**
-     * @dataProvider profile_value_data
-     */
-    public function test_get_profile_value($value, $field_options, $expected, $description)
-    {
-        $field_options = array_merge($this->field_options, $field_options);
+	/**
+	 * @dataProvider profile_value_data
+	 */
+	public function test_get_profile_value($value, $field_options, $expected, $description)
+	{
+		$field_options = array_merge($this->field_options, $field_options);
 
-        $result = $this->cp->get_profile_value($value, $field_options);
+		$result = $this->cp->get_profile_value($value, $field_options);
 
-        $this->assertSame($expected, $result, $description);
-    }
+		$this->assertSame($expected, $result, $description);
+	}
 
-    public function is_set_callback($field_id, $lang_id, $field_value)
-    {
-        return isset($this->options[$field_value]);
-    }
+	public function is_set_callback($field_id, $lang_id, $field_value)
+	{
+		return isset($this->options[$field_value]);
+	}
 
-    public function get($field_id, $lang_id, $field_value)
-    {
-        return $this->options[$field_value];
-    }
+	public function get($field_id, $lang_id, $field_value)
+	{
+		return $this->options[$field_value];
+	}
 
-    public function return_callback_implode()
-    {
-        return implode('-', func_get_args());
-    }
+	public function return_callback_implode()
+	{
+		return implode('-', func_get_args());
+	}
 }
diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php
index 05bf72d0b9..f356e7727c 100644
--- a/tests/profilefields/type_date_test.php
+++ b/tests/profilefields/type_date_test.php
@@ -13,180 +13,180 @@
 
 class phpbb_profilefield_type_date_test extends phpbb_test_case
 {
-    protected $cp;
-    protected $field_options;
-    protected $user;
+	protected $cp;
+	protected $field_options;
+	protected $user;
 
-    /**
-     * Sets up basic test objects
-     *
-     * @access public
-     * @return null
-     */
-    public function setUp()
-    {
-        $this->user = $this->getMock('\phpbb\user');
-        $this->user->expects($this->any())
-            ->method('lang')
-            ->will($this->returnCallback(array($this, 'return_callback_implode')));
+	/**
+	 * Sets up basic test objects
+	 *
+	 * @access public
+	 * @return null
+	 */
+	public function setUp()
+	{
+		$this->user = $this->getMock('\phpbb\user');
+		$this->user->expects($this->any())
+			->method('lang')
+			->will($this->returnCallback(array($this, 'return_callback_implode')));
 
-        $this->user->expects($this->any())
-            ->method('create_datetime')
-            ->will($this->returnCallback(array($this, 'create_datetime_callback')));
+		$this->user->expects($this->any())
+			->method('create_datetime')
+			->will($this->returnCallback(array($this, 'create_datetime_callback')));
 
-        $this->user->timezone = new DateTimeZone('UTC');
-        $this->user->lang = array(
-            'datetime' => array(),
-            'DATE_FORMAT' => 'm/d/Y',
-        );
+		$this->user->timezone = new DateTimeZone('UTC');
+		$this->user->lang = array(
+			'datetime' => array(),
+			'DATE_FORMAT' => 'm/d/Y',
+		);
 
-        $request = $this->getMock('\phpbb\request\request');
-        $template = $this->getMock('\phpbb\template\template');
+		$request = $this->getMock('\phpbb\request\request');
+		$template = $this->getMock('\phpbb\template\template');
 
-        $this->cp = new \phpbb\profilefields\type\type_date(
-            $request,
-            $template,
-            $this->user
-        );
+		$this->cp = new \phpbb\profilefields\type\type_date(
+			$request,
+			$template,
+			$this->user
+		);
 
-        $this->field_options = array(
-            'field_type'     => '\phpbb\profilefields\type\type_date',
-            'field_name' 	 => 'field',
-            'field_id'	 	 => 1,
-            'lang_id'	 	 => 1,
-            'lang_name'      => 'field',
-            'field_required' => false,
-        );
-    }
+		$this->field_options = array(
+			'field_type'     => '\phpbb\profilefields\type\type_date',
+			'field_name' 	 => 'field',
+			'field_id'	 	 => 1,
+			'lang_id'	 	 => 1,
+			'lang_name'      => 'field',
+			'field_required' => false,
+		);
+	}
 
-    public function profile_value_data()
-    {
-        return array(
-            array(
-                    '01-01-2009',
-                    array('field_show_novalue' => true),
-                    '01/01/2009',
-                    'Field should output the correctly formatted date',
-            ),
-            array(
-                    null,
-                    array('field_show_novalue' => false),
-                    null,
-                    'Field should leave empty value as is',
-            ),
-            array(
-                    'None',
-                    array('field_show_novalue' => true),
-                    'None',
-                    'Field should leave invalid value as is',
-            ),
-        );
-    }
+	public function profile_value_data()
+	{
+		return array(
+			array(
+					'01-01-2009',
+					array('field_show_novalue' => true),
+					'01/01/2009',
+					'Field should output the correctly formatted date',
+			),
+			array(
+					null,
+					array('field_show_novalue' => false),
+					null,
+					'Field should leave empty value as is',
+			),
+			array(
+					'None',
+					array('field_show_novalue' => true),
+					'None',
+					'Field should leave invalid value as is',
+			),
+		);
+	}
 
-    /**
-     * @dataProvider profile_value_data
-     */
-    public function test_get_profile_value($value, $field_options, $expected, $description)
-    {
-        $field_options = array_merge($this->field_options, $field_options);
+	/**
+	 * @dataProvider profile_value_data
+	 */
+	public function test_get_profile_value($value, $field_options, $expected, $description)
+	{
+		$field_options = array_merge($this->field_options, $field_options);
 
-        $result = $this->cp->get_profile_value($value, $field_options);
+		$result = $this->cp->get_profile_value($value, $field_options);
 
-        $this->assertSame($expected, $result, $description);
-    }
+		$this->assertSame($expected, $result, $description);
+	}
 
-    public function validate_profile_field_data()
-    {
-        return array(
-            array(
-                    '',
-                    array('field_required' => true),
-                    'FIELD_REQUIRED-field',
-                    'Field should reject value for being empty',
-            ),
-            array(
-                    '0125',
-                    array('field_required' => true),
-                    'FIELD_REQUIRED-field',
-                    'Field should reject value for being invalid',
-            ),
-            array(
-                    '01-01-2012',
-                    array(),
-                    false,
-                    'Field should accept a valid value',
-            ),
-            array(
-                    '40-05-2009',
-                    array(),
-                    'FIELD_INVALID_DATE-field',
-                    'Field should reject value for being invalid',
-            ),
-            array(
-                    '12-30-2012',
-                    array(),
-                    'FIELD_INVALID_DATE-field',
-                    'Field should reject value for being invalid',
-            ),
-            array(
-                    'string',
-                    array(),
-                    false,
-                    'Field should reject value for being invalid',
-            ),
-            array(
-                    'string',
-                    array('field_required' => true),
-                    'FIELD_REQUIRED-field',
-                    'Field should reject value for being invalid',
-            ),
-            array(
-                    100,
-                    array(),
-                    false,
-                    'Field should reject value for being invalid',
-            ),
-            array(
-                    100,
-                    array('field_required' => true),
-                    'FIELD_REQUIRED-field',
-                    'Field should reject value for being invalid',
-            ),
-            array(
-                    null,
-                    array('field_required' => true),
-                    'FIELD_REQUIRED-field',
-                    'Field should reject value for being empty',
-            ),
-            array(
-                    true,
-                    array('field_required' => true),
-                    'FIELD_REQUIRED-field',
-                    'Field should reject value for being empty',
-            ),
-        );
-    }
+	public function validate_profile_field_data()
+	{
+		return array(
+			array(
+					'',
+					array('field_required' => true),
+					'FIELD_REQUIRED-field',
+					'Field should reject value for being empty',
+			),
+			array(
+					'0125',
+					array('field_required' => true),
+					'FIELD_REQUIRED-field',
+					'Field should reject value for being invalid',
+			),
+			array(
+					'01-01-2012',
+					array(),
+					false,
+					'Field should accept a valid value',
+			),
+			array(
+					'40-05-2009',
+					array(),
+					'FIELD_INVALID_DATE-field',
+					'Field should reject value for being invalid',
+			),
+			array(
+					'12-30-2012',
+					array(),
+					'FIELD_INVALID_DATE-field',
+					'Field should reject value for being invalid',
+			),
+			array(
+					'string',
+					array(),
+					false,
+					'Field should reject value for being invalid',
+			),
+			array(
+					'string',
+					array('field_required' => true),
+					'FIELD_REQUIRED-field',
+					'Field should reject value for being invalid',
+			),
+			array(
+					100,
+					array(),
+					false,
+					'Field should reject value for being invalid',
+			),
+			array(
+					100,
+					array('field_required' => true),
+					'FIELD_REQUIRED-field',
+					'Field should reject value for being invalid',
+			),
+			array(
+					null,
+					array('field_required' => true),
+					'FIELD_REQUIRED-field',
+					'Field should reject value for being empty',
+			),
+			array(
+					true,
+					array('field_required' => true),
+					'FIELD_REQUIRED-field',
+					'Field should reject value for being empty',
+			),
+		);
+	}
 
-    /**
-     * @dataProvider validate_profile_field_data
-     */
-    public function test_validate_profile_field($value, $field_options, $expected, $description)
-    {
-        $field_options = array_merge($this->field_options, $field_options);
+	/**
+	 * @dataProvider validate_profile_field_data
+	 */
+	public function test_validate_profile_field($value, $field_options, $expected, $description)
+	{
+		$field_options = array_merge($this->field_options, $field_options);
 
-        $result = $this->cp->validate_profile_field($value, $field_options);
+		$result = $this->cp->validate_profile_field($value, $field_options);
 
-        $this->assertSame($expected, $result, $description);
-    }
+		$this->assertSame($expected, $result, $description);
+	}
 
-    public function return_callback_implode()
-    {
-        return implode('-', func_get_args());
-    }
+	public function return_callback_implode()
+	{
+		return implode('-', func_get_args());
+	}
 
-    public function create_datetime_callback($time = 'now', \DateTimeZone $timezone = null)
-    {
-        $timezone = $timezone ?: $this->user->timezone;
-        return new \phpbb\datetime($this->user, $time, $timezone);
-    }
+	public function create_datetime_callback($time = 'now', \DateTimeZone $timezone = null)
+	{
+		$timezone = $timezone ?: $this->user->timezone;
+		return new \phpbb\datetime($this->user, $time, $timezone);
+	}
 }
diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index ec68f0e77e..559ec254a7 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -13,175 +13,175 @@
 
 class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
 {
-    protected $cp;
-    protected $field_options = array();
-    protected $dropdown_options = array();
+	protected $cp;
+	protected $field_options = array();
+	protected $dropdown_options = array();
 
-    /**
-     * Sets up basic test objects
-     *
-     * @access public
-     * @return null
-     */
-    public function setUp()
-    {
-        $user = $this->getMock('\phpbb\user');
-        $user->expects($this->any())
-            ->method('lang')
-            ->will($this->returnCallback(array($this, 'return_callback_implode')));
+	/**
+	 * Sets up basic test objects
+	 *
+	 * @access public
+	 * @return null
+	 */
+	public function setUp()
+	{
+		$user = $this->getMock('\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->getMock('\phpbb\request\request');
+		$template = $this->getMock('\phpbb\template\template');
 
-        $lang = $this->getMock('\phpbb\profilefields\lang_helper', array(), array(null, null));
+		$lang = $this->getMock('\phpbb\profilefields\lang_helper', array(), array(null, null));
 
-        $lang->expects($this->any())
-             ->method('get_options_lang');
+		$lang->expects($this->any())
+			 ->method('get_options_lang');
 
-        $lang->expects($this->any())
-             ->method('is_set')
-             ->will($this->returnCallback(array($this, 'is_set_callback')));
+		$lang->expects($this->any())
+			 ->method('is_set')
+			 ->will($this->returnCallback(array($this, 'is_set_callback')));
 
-        $lang->expects($this->any())
-             ->method('get')
-             ->will($this->returnCallback(array($this, 'get')));
+		$lang->expects($this->any())
+			 ->method('get')
+			 ->will($this->returnCallback(array($this, 'get')));
 
-        $this->cp = new \phpbb\profilefields\type\type_dropdown(
-            $lang,
-            $request,
-            $template,
-            $user
-        );
+		$this->cp = new \phpbb\profilefields\type\type_dropdown(
+			$lang,
+			$request,
+			$template,
+			$user
+		);
 
-        $this->field_options = array(
-            'field_type'       => '\phpbb\profilefields\type\type_dropdown',
-            'field_name' 	   => 'field',
-            'field_id'	 	   => 1,
-            'lang_id'	 	   => 1,
-            'lang_name'        => 'field',
-            'field_required'   => false,
-            'field_validation' => '.*',
-            'field_novalue'    => 0,
-        );
+		$this->field_options = array(
+			'field_type'       => '\phpbb\profilefields\type\type_dropdown',
+			'field_name' 	   => 'field',
+			'field_id'	 	   => 1,
+			'lang_id'	 	   => 1,
+			'lang_name'        => 'field',
+			'field_required'   => false,
+			'field_validation' => '.*',
+			'field_novalue'    => 0,
+		);
 
-        $this->dropdown_options = array(
-            0 => '<No Value>',
-            1 => 'Option 1',
-            2 => 'Option 2',
-            3 => 'Option 3',
-            4 => 'Option 4',
-        );
-    }
+		$this->dropdown_options = array(
+			0 => '<No Value>',
+			1 => 'Option 1',
+			2 => 'Option 2',
+			3 => 'Option 3',
+			4 => 'Option 4',
+		);
+	}
 
-    public function validate_profile_field_data()
-    {
-        return array(
-            array(
-                    7,
-                    array(),
-                    'FIELD_INVALID_VALUE-field',
-                    'Invalid value should throw error',
-            ),
-            array(
-                    true,
-                    array('field_required' => true),
-                    false,
-                    'Boolean would evaluate to 1 and hence correct value',
-            ),
-            array(
-                    'string',
-                    array('field_required' => true),
-                    'FIELD_REQUIRED-field',
-                    'String should be rejected for value',
-            ),
-            array(
-                    2,
-                    array(),
-                    false,
-                    'Valid value should not throw error'
-            ),
-            array(
-                    0,
-                    array(),
-                    false,
-                    'Empty value should be acceptible',
-            ),
-            array(
-                    0,
-                    array('field_required' => true),
-                    'FIELD_REQUIRED-field',
-                    'Required field should not accept empty value',
-            ),
-        );
-    }
+	public function validate_profile_field_data()
+	{
+		return array(
+			array(
+					7,
+					array(),
+					'FIELD_INVALID_VALUE-field',
+					'Invalid value should throw error',
+			),
+			array(
+					true,
+					array('field_required' => true),
+					false,
+					'Boolean would evaluate to 1 and hence correct value',
+			),
+			array(
+					'string',
+					array('field_required' => true),
+					'FIELD_REQUIRED-field',
+					'String should be rejected for value',
+			),
+			array(
+					2,
+					array(),
+					false,
+					'Valid value should not throw error'
+			),
+			array(
+					0,
+					array(),
+					false,
+					'Empty value should be acceptible',
+			),
+			array(
+					0,
+					array('field_required' => true),
+					'FIELD_REQUIRED-field',
+					'Required field should not accept empty value',
+			),
+		);
+	}
 
-    /**
-     * @dataProvider validate_profile_field_data
-     */
-    public function test_validate_profile_field($value, $field_options, $expected, $description)
-    {
-        $field_options = array_merge($this->field_options, $field_options);
+	/**
+	 * @dataProvider validate_profile_field_data
+	 */
+	public function test_validate_profile_field($value, $field_options, $expected, $description)
+	{
+		$field_options = array_merge($this->field_options, $field_options);
 
-        $result = $this->cp->validate_profile_field($value, $field_options);
+		$result = $this->cp->validate_profile_field($value, $field_options);
 
-        $this->assertSame($expected, $result, $description);
-    }
+		$this->assertSame($expected, $result, $description);
+	}
 
-    public function profile_value_data()
-    {
-        return array(
-            array(
-                    1,
-                    array('field_show_novalue' => true),
-                    'Option 1',
-                    'Field should output the given value',
-            ),
-            array(
-                    4,
-                    array('field_show_novalue' => false),
-                    'Option 4',
-                    'Field should output the given value',
-            ),
-            array(
-                    '',
-                    array('field_show_novalue' => true),
-                    '<No Value>',
-                    'Field should output nothing for empty value',
-            ),
-            array(
-                    '',
-                    array('field_show_novalue' => false),
-                    null,
-                    'Field should simply output null for empty value',
-            ),
-        );
-    }
+	public function profile_value_data()
+	{
+		return array(
+			array(
+					1,
+					array('field_show_novalue' => true),
+					'Option 1',
+					'Field should output the given value',
+			),
+			array(
+					4,
+					array('field_show_novalue' => false),
+					'Option 4',
+					'Field should output the given value',
+			),
+			array(
+					'',
+					array('field_show_novalue' => true),
+					'<No Value>',
+					'Field should output nothing for empty value',
+			),
+			array(
+					'',
+					array('field_show_novalue' => false),
+					null,
+					'Field should simply output null for empty value',
+			),
+		);
+	}
 
 
-    /**
-     * @dataProvider profile_value_data
-     */
-    public function test_get_profile_value($value, $field_options, $expected, $description)
-    {
-        $field_options = array_merge($this->field_options, $field_options);
+	/**
+	 * @dataProvider profile_value_data
+	 */
+	public function test_get_profile_value($value, $field_options, $expected, $description)
+	{
+		$field_options = array_merge($this->field_options, $field_options);
 
-        $result = $this->cp->get_profile_value($value, $field_options);
+		$result = $this->cp->get_profile_value($value, $field_options);
 
-        $this->assertSame($expected, $result, $description);
-    }
+		$this->assertSame($expected, $result, $description);
+	}
 
-    public function is_set_callback($field_id, $lang_id, $field_value)
-    {
-        return isset($this->dropdown_options[$field_value]);
-    }
+	public function is_set_callback($field_id, $lang_id, $field_value)
+	{
+		return isset($this->dropdown_options[$field_value]);
+	}
 
-    public function get($field_id, $lang_id, $field_value)
-    {
-        return $this->dropdown_options[$field_value];
-    }
+	public function get($field_id, $lang_id, $field_value)
+	{
+		return $this->dropdown_options[$field_value];
+	}
 
-    public function return_callback_implode()
-    {
-        return implode('-', func_get_args());
-    }
+	public function return_callback_implode()
+	{
+		return implode('-', func_get_args());
+	}
 }
diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php
index 11278e8f52..9b0adcb78c 100644
--- a/tests/profilefields/type_int_test.php
+++ b/tests/profilefields/type_int_test.php
@@ -13,164 +13,164 @@
 
 class phpbb_profilefield_type_int_test extends phpbb_test_case
 {
-    protected $cp;
-    protected $field_options;
+	protected $cp;
+	protected $field_options;
 
-    /**
-     * Sets up basic test objects
-     *
-     * @access public
-     * @return null
-     */
-    public function setUp()
-    {
-        $user = $this->getMock('\phpbb\user');
-        $user->expects($this->any())
-            ->method('lang')
-            ->will($this->returnCallback(array($this, 'return_callback_implode')));
+	/**
+	 * Sets up basic test objects
+	 *
+	 * @access public
+	 * @return null
+	 */
+	public function setUp()
+	{
+		$user = $this->getMock('\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->getMock('\phpbb\request\request');
+		$template = $this->getMock('\phpbb\template\template');
 
-        $this->cp = new \phpbb\profilefields\type\type_int(
-            $request,
-            $template,
-            $user
-        );
+		$this->cp = new \phpbb\profilefields\type\type_int(
+			$request,
+			$template,
+			$user
+		);
 
-        $this->field_options = array(
-            'field_type'     => '\phpbb\profilefields\type\type_int',
-            'field_name' 	 => 'field',
-            'field_id'	 	 => 1,
-            'lang_id'	 	 => 1,
-            'lang_name'      => 'field',
-            'field_required' => false,
-        );
-    }
+		$this->field_options = array(
+			'field_type'     => '\phpbb\profilefields\type\type_int',
+			'field_name' 	 => 'field',
+			'field_id'	 	 => 1,
+			'lang_id'	 	 => 1,
+			'lang_name'      => 'field',
+			'field_required' => false,
+		);
+	}
 
-    public function profile_value_data()
-    {
-        return array(
-            array(
-                    '10',
-                    array('field_show_novalue' => true),
-                    10,
-                    'Field should output integer value of given input',
-            ),
-            array(
-                    '0',
-                    array('field_show_novalue' => true),
-                    0,
-                    'Field should output integer value of given input',
-            ),
-            array(
-                    '',
-                    array('field_show_novalue' => true),
-                    0,
-                    'Field should translate empty value to 0 as integer',
-                    false,
-            ),
-            array(
-                    null,
-                    array('field_show_novalue' => true),
-                    0,
-                    'Field should translate null value to 0 as integer',
-            ),
-            array(
-                    '10',
-                    array('field_show_novalue' => false),
-                    10,
-                    'Field should output integer value of given input',
-            ),
-            array(
-                    '0',
-                    array('field_show_novalue' => false),
-                    0,
-                    'Field should output integer value of given input',
-            ),
-            array(
-                    '',
-                    array('field_show_novalue' => false),
-                    null,
-                    'Field should leave empty value as is',
-            ),
-            array(
-                    null,
-                    array('field_show_novalue' => false),
-                    null,
-                    'Field should leave empty value as is',
-            ),
-        );
-    }
+	public function profile_value_data()
+	{
+		return array(
+			array(
+					'10',
+					array('field_show_novalue' => true),
+					10,
+					'Field should output integer value of given input',
+			),
+			array(
+					'0',
+					array('field_show_novalue' => true),
+					0,
+					'Field should output integer value of given input',
+			),
+			array(
+					'',
+					array('field_show_novalue' => true),
+					0,
+					'Field should translate empty value to 0 as integer',
+					false,
+			),
+			array(
+					null,
+					array('field_show_novalue' => true),
+					0,
+					'Field should translate null value to 0 as integer',
+			),
+			array(
+					'10',
+					array('field_show_novalue' => false),
+					10,
+					'Field should output integer value of given input',
+			),
+			array(
+					'0',
+					array('field_show_novalue' => false),
+					0,
+					'Field should output integer value of given input',
+			),
+			array(
+					'',
+					array('field_show_novalue' => false),
+					null,
+					'Field should leave empty value as is',
+			),
+			array(
+					null,
+					array('field_show_novalue' => false),
+					null,
+					'Field should leave empty value as is',
+			),
+		);
+	}
 
-    /**
-     * @dataProvider profile_value_data
-     */
-    public function test_get_profile_value($value, $field_options, $expected, $description)
-    {
-        $field_options = array_merge($this->field_options, $field_options);
+	/**
+	 * @dataProvider profile_value_data
+	 */
+	public function test_get_profile_value($value, $field_options, $expected, $description)
+	{
+		$field_options = array_merge($this->field_options, $field_options);
 
-        $result = $this->cp->get_profile_value($value, $field_options);
+		$result = $this->cp->get_profile_value($value, $field_options);
 
-        $this->assertSame($expected, $result, $description);
-    }
+		$this->assertSame($expected, $result, $description);
+	}
 
-    public function validate_profile_field_data()
-    {
-        return array(
-            array(
-                    '15',
-                    array('field_minlen' => 10, 'field_maxlen' => 20, 'field_required' => true),
-                    false,
-                    'Field should accept input of correct boundaries',
-            ),
-            array(
-                    '556476',
-                    array('field_maxlen' => 50000, 'field_required' => true),
-                    'FIELD_TOO_LARGE-50000-field',
-                    'Field should reject value of greater value than max',
-            ),
-            array(
-                    '9',
-                    array('field_minlen' => 10, 'field_required' => true),
-                    'FIELD_TOO_SMALL-10-field',
-                    'Field should reject value which is less than defined minimum',
-            ),
-            array(
-                    true,
-                    array('field_maxlen' => 20),
-                    false,
-                    'Field should accept correct boolean value',
-            ),
-            array(
-                    'string',
-                    array('field_maxlen' => 10, 'field_required' => true),
-                    false,
-                    'Field should accept correct string value',
-            ),
-            array(
-                    null,
-                    array('field_minlen' => 1, 'field_maxlen' => 10, 'field_required' => true),
-                    'FIELD_TOO_SMALL-1-field',
-                    'Field should not accept an empty value',
-            ),
-        );
-    }
+	public function validate_profile_field_data()
+	{
+		return array(
+			array(
+					'15',
+					array('field_minlen' => 10, 'field_maxlen' => 20, 'field_required' => true),
+					false,
+					'Field should accept input of correct boundaries',
+			),
+			array(
+					'556476',
+					array('field_maxlen' => 50000, 'field_required' => true),
+					'FIELD_TOO_LARGE-50000-field',
+					'Field should reject value of greater value than max',
+			),
+			array(
+					'9',
+					array('field_minlen' => 10, 'field_required' => true),
+					'FIELD_TOO_SMALL-10-field',
+					'Field should reject value which is less than defined minimum',
+			),
+			array(
+					true,
+					array('field_maxlen' => 20),
+					false,
+					'Field should accept correct boolean value',
+			),
+			array(
+					'string',
+					array('field_maxlen' => 10, 'field_required' => true),
+					false,
+					'Field should accept correct string value',
+			),
+			array(
+					null,
+					array('field_minlen' => 1, 'field_maxlen' => 10, 'field_required' => true),
+					'FIELD_TOO_SMALL-1-field',
+					'Field should not accept an empty value',
+			),
+		);
+	}
 
-    /**
-     * @dataProvider validate_profile_field_data
-     */
-    public function test_validate_profile_field($value, $field_options, $expected, $description)
-    {
-        $field_options = array_merge($this->field_options, $field_options);
+	/**
+	 * @dataProvider validate_profile_field_data
+	 */
+	public function test_validate_profile_field($value, $field_options, $expected, $description)
+	{
+		$field_options = array_merge($this->field_options, $field_options);
 
-        $result = $this->cp->validate_profile_field($value, $field_options);
+		$result = $this->cp->validate_profile_field($value, $field_options);
 
-        $this->assertSame($expected, $result, $description);
-    }
+		$this->assertSame($expected, $result, $description);
+	}
 
-    public function return_callback_implode()
-    {
-        return implode('-', func_get_args());
-    }
+	public function return_callback_implode()
+	{
+		return implode('-', func_get_args());
+	}
 }
diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
index 8e24b7a3f0..5c376eea3a 100644
--- a/tests/profilefields/type_string_test.php
+++ b/tests/profilefields/type_string_test.php
@@ -17,192 +17,192 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
 
 class phpbb_profilefield_type_string_test extends phpbb_test_case
 {
-    protected $cp;
-    protected $field_options;
+	protected $cp;
+	protected $field_options;
 
-    /**
-     * Sets up basic test objects
-     *
-     * @access public
-     * @return null
-     */
-    public function setUp()
-    {
-        global $request, $user, $cache;
+	/**
+	 * Sets up basic test objects
+	 *
+	 * @access public
+	 * @return null
+	 */
+	public function setUp()
+	{
+		global $request, $user, $cache;
 
-        $user = $this->getMock('\phpbb\user');
-        $cache = new phpbb_mock_cache;
-        $user->expects($this->any())
-            ->method('lang')
-            ->will($this->returnCallback(array($this, 'return_callback_implode')));
+		$user = $this->getMock('\phpbb\user');
+		$cache = new phpbb_mock_cache;
+		$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->getMock('\phpbb\request\request');
+		$template = $this->getMock('\phpbb\template\template');
 
-        $this->cp = new \phpbb\profilefields\type\type_string(
-            $request,
-            $template,
-            $user
-        );
+		$this->cp = new \phpbb\profilefields\type\type_string(
+			$request,
+			$template,
+			$user
+		);
 
-        $this->field_options = array(
-            'field_type'       => '\phpbb\profilefields\type\type_string',
-            'field_name' 	   => 'field',
-            'field_id'	 	   => 1,
-            'lang_id'	 	   => 1,
-            'lang_name'        => 'field',
-            'field_required'   => false,
-            'field_validation' => '.*',
-        );
-    }
+		$this->field_options = array(
+			'field_type'       => '\phpbb\profilefields\type\type_string',
+			'field_name' 	   => 'field',
+			'field_id'	 	   => 1,
+			'lang_id'	 	   => 1,
+			'lang_name'        => 'field',
+			'field_required'   => false,
+			'field_validation' => '.*',
+		);
+	}
 
-    public function validate_profile_field_data()
-    {
-        return array(
-            array(
-                    '',
-                    array('field_required' => true),
-                    'FIELD_REQUIRED-field',
-                    'Field should not accept empty values for required fields',
-            ),
-            array(
-                    null,
-                    array('field_required' => true),
-                    'FIELD_REQUIRED-field',
-                    'Field should not accept empty values for required field',
-            ),
-            array(
-                    0,
-                    array('field_required' => true),
-                    false,
-                    'Field should accept a non-empty input',
-            ),
-            array(
-                    'false',
-                    array('field_required' => true),
-                    false,
-                    'Field should accept a non-empty input',
-            ),
-            array(
-                    10,
-                    array('field_required' => true),
-                    false,
-                    'Field should accept a non-empty input',
-            ),
-            array(
-                    'tas',
-                    array('field_minlen' => 2, 'field_maxlen' => 5),
-                    false,
-                    'Field should accept value of correct length',
-            ),
-            array(
-                    't',
-                    array('field_minlen' => 2, 'field_maxlen' => 5),
-                    'FIELD_TOO_SHORT-2-field',
-                    'Field should reject value of incorrect length',
-            ),
-            array(
-                    'this is a long string',
-                    array('field_minlen' => 2, 'field_maxlen' => 5),
-                    'FIELD_TOO_LONG-5-field',
-                    'Field should reject value of incorrect length',
-            ),
-            array(
-                    'H3110',
-                    array('field_validation' => '[0-9]+'),
-                    'FIELD_INVALID_CHARS_NUMBERS_ONLY-field',
-                    'Required field should reject characters in a numbers-only field',
-            ),
-            array(
-                    '&lt;&gt;&quot;&amp;%&amp;&gt;&lt;&gt;',
-                    array('field_maxlen' => 10, 'field_minlen' => 2),
-                    false,
-                    'Optional field should accept html entities',
-            ),
-            array(
-                    'ö ä ü ß',
-                    array(),
-                    false,
-                    'Required field should accept UTF-8 string',
-            ),
-            array(
-                    'This ö ä string has to b',
-                    array('field_maxlen' => 10),
-                    'FIELD_TOO_LONG-10-field',
-                    'Required field should reject an UTF-8 string which is too long',
-            ),
-            array(
-                    'ö äö äö ä',
-                    array('field_validation' => '[\w]+'),
-                    'FIELD_INVALID_CHARS_ALPHA_ONLY-field',
-                    'Required field should reject UTF-8 in alpha only field',
-            ),
-            array(
-                    'Hello',
-                    array('field_validation' => '[\w]+'),
-                    false,
-                    'Required field should accept a characters only field',
-            ),
-        );
-    }
+	public function validate_profile_field_data()
+	{
+		return array(
+			array(
+					'',
+					array('field_required' => true),
+					'FIELD_REQUIRED-field',
+					'Field should not accept empty values for required fields',
+			),
+			array(
+					null,
+					array('field_required' => true),
+					'FIELD_REQUIRED-field',
+					'Field should not accept empty values for required field',
+			),
+			array(
+					0,
+					array('field_required' => true),
+					false,
+					'Field should accept a non-empty input',
+			),
+			array(
+					'false',
+					array('field_required' => true),
+					false,
+					'Field should accept a non-empty input',
+			),
+			array(
+					10,
+					array('field_required' => true),
+					false,
+					'Field should accept a non-empty input',
+			),
+			array(
+					'tas',
+					array('field_minlen' => 2, 'field_maxlen' => 5),
+					false,
+					'Field should accept value of correct length',
+			),
+			array(
+					't',
+					array('field_minlen' => 2, 'field_maxlen' => 5),
+					'FIELD_TOO_SHORT-2-field',
+					'Field should reject value of incorrect length',
+			),
+			array(
+					'this is a long string',
+					array('field_minlen' => 2, 'field_maxlen' => 5),
+					'FIELD_TOO_LONG-5-field',
+					'Field should reject value of incorrect length',
+			),
+			array(
+					'H3110',
+					array('field_validation' => '[0-9]+'),
+					'FIELD_INVALID_CHARS_NUMBERS_ONLY-field',
+					'Required field should reject characters in a numbers-only field',
+			),
+			array(
+					'&lt;&gt;&quot;&amp;%&amp;&gt;&lt;&gt;',
+					array('field_maxlen' => 10, 'field_minlen' => 2),
+					false,
+					'Optional field should accept html entities',
+			),
+			array(
+					'ö ä ü ß',
+					array(),
+					false,
+					'Required field should accept UTF-8 string',
+			),
+			array(
+					'This ö ä string has to b',
+					array('field_maxlen' => 10),
+					'FIELD_TOO_LONG-10-field',
+					'Required field should reject an UTF-8 string which is too long',
+			),
+			array(
+					'ö äö äö ä',
+					array('field_validation' => '[\w]+'),
+					'FIELD_INVALID_CHARS_ALPHA_ONLY-field',
+					'Required field should reject UTF-8 in alpha only field',
+			),
+			array(
+					'Hello',
+					array('field_validation' => '[\w]+'),
+					false,
+					'Required field should accept a characters only field',
+			),
+		);
+	}
 
-    /**
-     * @dataProvider validate_profile_field_data
-     */
-    public function test_validate_profile_field($value, $field_options, $expected, $description)
-    {
-        $field_options = array_merge($this->field_options, $field_options);
+	/**
+	 * @dataProvider validate_profile_field_data
+	 */
+	public function test_validate_profile_field($value, $field_options, $expected, $description)
+	{
+		$field_options = array_merge($this->field_options, $field_options);
 
-        $result = $this->cp->validate_profile_field($value, $field_options);
+		$result = $this->cp->validate_profile_field($value, $field_options);
 
-        $this->assertSame($expected, $result, $description);
-    }
+		$this->assertSame($expected, $result, $description);
+	}
 
-    public function profile_value_data()
-    {
-        return array(
-            array(
-                    'test',
-                    array('field_show_novalue' => true),
-                    'test',
-                    'Field should output the given value',
-            ),
-            array(
-                    'test',
-                    array('field_show_novalue' => false),
-                    'test',
-                    'Field should output the given value',
-            ),
-            array(
-                    '',
-                    array('field_show_novalue' => true),
-                    '',
-                    'Field should output nothing for empty value',
-            ),
-            array(
-                    '',
-                    array('field_show_novalue' => false),
-                    null,
-                    'Field should simply output null for empty vlaue',
-            ),
-        );
-    }
+	public function profile_value_data()
+	{
+		return array(
+			array(
+					'test',
+					array('field_show_novalue' => true),
+					'test',
+					'Field should output the given value',
+			),
+			array(
+					'test',
+					array('field_show_novalue' => false),
+					'test',
+					'Field should output the given value',
+			),
+			array(
+					'',
+					array('field_show_novalue' => true),
+					'',
+					'Field should output nothing for empty value',
+			),
+			array(
+					'',
+					array('field_show_novalue' => false),
+					null,
+					'Field should simply output null for empty vlaue',
+			),
+		);
+	}
 
 
-    /**
-     * @dataProvider profile_value_data
-     */
-    public function test_get_profile_value($value, $field_options, $expected, $description)
-    {
-        $field_options = array_merge($this->field_options, $field_options);
+	/**
+	 * @dataProvider profile_value_data
+	 */
+	public function test_get_profile_value($value, $field_options, $expected, $description)
+	{
+		$field_options = array_merge($this->field_options, $field_options);
 
-        $result = $this->cp->get_profile_value($value, $field_options);
+		$result = $this->cp->get_profile_value($value, $field_options);
 
-        $this->assertSame($expected, $result, $description);
-    }
+		$this->assertSame($expected, $result, $description);
+	}
 
-    public function return_callback_implode()
-    {
-        return implode('-', func_get_args());
-    }
+	public function return_callback_implode()
+	{
+		return implode('-', func_get_args());
+	}
 }
diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php
index 68ae0f6b7d..3dd32401a0 100644
--- a/tests/profilefields/type_url_test.php
+++ b/tests/profilefields/type_url_test.php
@@ -15,97 +15,97 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
 
 class phpbb_profilefield_type_url_test extends phpbb_test_case
 {
-    protected $cp;
-    protected $field_options;
+	protected $cp;
+	protected $field_options;
 
-    /**
-     * Sets up basic test objects
-     *
-     * @access public
-     * @return null
-     */
-    public function setUp()
-    {
-        $user = $this->getMock('\phpbb\user');
-        $user->expects($this->any())
-            ->method('lang')
-            ->will($this->returnCallback(array($this, 'return_callback_implode')));
+	/**
+	 * Sets up basic test objects
+	 *
+	 * @access public
+	 * @return null
+	 */
+	public function setUp()
+	{
+		$user = $this->getMock('\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->getMock('\phpbb\request\request');
+		$template = $this->getMock('\phpbb\template\template');
 
-        $this->cp = new \phpbb\profilefields\type\type_url(
-            $request,
-            $template,
-            $user
-        );
+		$this->cp = new \phpbb\profilefields\type\type_url(
+			$request,
+			$template,
+			$user
+		);
 
-        $this->field_options = array(
-            'field_type'     => '\phpbb\profilefields\type\type_url',
-            'field_name' 	 => 'field',
-            'field_id'	 	 => 1,
-            'lang_id'	 	 => 1,
-            'lang_name'      => 'field',
-            'field_required' => false,
-        );
-    }
+		$this->field_options = array(
+			'field_type'     => '\phpbb\profilefields\type\type_url',
+			'field_name' 	 => 'field',
+			'field_id'	 	 => 1,
+			'lang_id'	 	 => 1,
+			'lang_name'      => 'field',
+			'field_required' => false,
+		);
+	}
 
-    public function validate_profile_field_data()
-    {
-        return array(
-            array(
-                '',
-                    array('field_required' => true),
-                    'FIELD_INVALID_URL-field',
-                    'Field should reject empty field that is required',
-            ),
-            array(
-                    'invalidURL',
-                    array(),
-                    'FIELD_INVALID_URL-field',
-                    'Field should reject invalid input',
-            ),
-            array(
-                    'http://onetwothree.example.io',
-                    array(),
-                    false,
-                    'Field should accept valid URL',
-            ),
-            array(
-                    'http://example.com/index.html?param1=test&param2=awesome',
-                    array(),
-                    false,
-                    'Field should accept valid URL',
-            ),
-            array(
-                    'http://example.com/index.html/test/path?document=get',
-                    array(),
-                    false,
-                    'Field should accept valid URL',
-            ),
-            array(
-                    'http://example.com/index.html/test/path?document[]=DocType%20test&document[]=AnotherDoc',
-                    array(),
-                    'FIELD_INVALID_URL-field',
-                    'Field should reject invalid URL having multi value parameters',
-            ),
-        );
-    }
+	public function validate_profile_field_data()
+	{
+		return array(
+			array(
+				'',
+					array('field_required' => true),
+					'FIELD_INVALID_URL-field',
+					'Field should reject empty field that is required',
+			),
+			array(
+					'invalidURL',
+					array(),
+					'FIELD_INVALID_URL-field',
+					'Field should reject invalid input',
+			),
+			array(
+					'http://onetwothree.example.io',
+					array(),
+					false,
+					'Field should accept valid URL',
+			),
+			array(
+					'http://example.com/index.html?param1=test&param2=awesome',
+					array(),
+					false,
+					'Field should accept valid URL',
+			),
+			array(
+					'http://example.com/index.html/test/path?document=get',
+					array(),
+					false,
+					'Field should accept valid URL',
+			),
+			array(
+					'http://example.com/index.html/test/path?document[]=DocType%20test&document[]=AnotherDoc',
+					array(),
+					'FIELD_INVALID_URL-field',
+					'Field should reject invalid URL having multi value parameters',
+			),
+		);
+	}
 
-    /**
-     * @dataProvider validate_profile_field_data
-     */
-    public function test_validate_profile_field($value, $field_options, $expected, $description)
-    {
-        $field_options = array_merge($this->field_options, $field_options);
+	/**
+	 * @dataProvider validate_profile_field_data
+	 */
+	public function test_validate_profile_field($value, $field_options, $expected, $description)
+	{
+		$field_options = array_merge($this->field_options, $field_options);
 
-        $result = $this->cp->validate_profile_field($value, $field_options);
+		$result = $this->cp->validate_profile_field($value, $field_options);
 
-        $this->assertSame($expected, $result, $description);
-    }
+		$this->assertSame($expected, $result, $description);
+	}
 
-    public function return_callback_implode()
-    {
-        return implode('-', func_get_args());
-    }
+	public function return_callback_implode()
+	{
+		return implode('-', func_get_args());
+	}
 }

From f076b4391545b77b58ae8a2303888ed63b7aec8e Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Wed, 18 Jun 2014 18:18:15 +0530
Subject: [PATCH 26/28] [ticket/12514] Missed a few spaces in comments

PHPBB3-12514
---
 tests/profilefields/type_bool_test.php     | 14 +++++++-------
 tests/profilefields/type_date_test.php     | 18 +++++++++---------
 tests/profilefields/type_dropdown_test.php | 18 +++++++++---------
 tests/profilefields/type_int_test.php      | 10 +++++-----
 tests/profilefields/type_string_test.php   | 18 +++++++++---------
 tests/profilefields/type_url_test.php      | 14 +++++++-------
 6 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php
index 87c9d7c96f..03ce9445e1 100644
--- a/tests/profilefields/type_bool_test.php
+++ b/tests/profilefields/type_bool_test.php
@@ -18,11 +18,11 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
 	protected $options = array();
 
 	/**
-	 * Sets up basic test objects
-	 *
-	 * @access public
-	 * @return void
-	 */
+	* Sets up basic test objects
+	*
+	* @access public
+	* @return void
+	*/
 	public function setUp()
 	{
 		$user = $this->getMock('\phpbb\user');
@@ -83,8 +83,8 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
 	}
 
 	/**
-	 * @dataProvider validate_profile_field_data
-	 */
+	* @dataProvider validate_profile_field_data
+	*/
 	public function test_validate_profile_field($value, $field_options, $expected, $description)
 	{
 		$field_options = array_merge($this->field_options, $field_options);
diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php
index f356e7727c..4c5dfce911 100644
--- a/tests/profilefields/type_date_test.php
+++ b/tests/profilefields/type_date_test.php
@@ -18,11 +18,11 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
 	protected $user;
 
 	/**
-	 * Sets up basic test objects
-	 *
-	 * @access public
-	 * @return null
-	 */
+	* Sets up basic test objects
+	*
+	* @access public
+	* @return null
+	*/
 	public function setUp()
 	{
 		$this->user = $this->getMock('\phpbb\user');
@@ -84,8 +84,8 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
 	}
 
 	/**
-	 * @dataProvider profile_value_data
-	 */
+	* @dataProvider profile_value_data
+	*/
 	public function test_get_profile_value($value, $field_options, $expected, $description)
 	{
 		$field_options = array_merge($this->field_options, $field_options);
@@ -168,8 +168,8 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
 	}
 
 	/**
-	 * @dataProvider validate_profile_field_data
-	 */
+	* @dataProvider validate_profile_field_data
+	*/
 	public function test_validate_profile_field($value, $field_options, $expected, $description)
 	{
 		$field_options = array_merge($this->field_options, $field_options);
diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index 559ec254a7..d1983eb4cb 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -18,11 +18,11 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
 	protected $dropdown_options = array();
 
 	/**
-	 * Sets up basic test objects
-	 *
-	 * @access public
-	 * @return null
-	 */
+	* Sets up basic test objects
+	*
+	* @access public
+	* @return null
+	*/
 	public function setUp()
 	{
 		$user = $this->getMock('\phpbb\user');
@@ -116,8 +116,8 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
 	}
 
 	/**
-	 * @dataProvider validate_profile_field_data
-	 */
+	* @dataProvider validate_profile_field_data
+	*/
 	public function test_validate_profile_field($value, $field_options, $expected, $description)
 	{
 		$field_options = array_merge($this->field_options, $field_options);
@@ -159,8 +159,8 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
 
 
 	/**
-	 * @dataProvider profile_value_data
-	 */
+	* @dataProvider profile_value_data
+	*/
 	public function test_get_profile_value($value, $field_options, $expected, $description)
 	{
 		$field_options = array_merge($this->field_options, $field_options);
diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php
index 9b0adcb78c..c43a20f59d 100644
--- a/tests/profilefields/type_int_test.php
+++ b/tests/profilefields/type_int_test.php
@@ -17,11 +17,11 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
 	protected $field_options;
 
 	/**
-	 * Sets up basic test objects
-	 *
-	 * @access public
-	 * @return null
-	 */
+	* Sets up basic test objects
+	*
+	* @access public
+	* @return null
+	*/
 	public function setUp()
 	{
 		$user = $this->getMock('\phpbb\user');
diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
index 5c376eea3a..b796ef3073 100644
--- a/tests/profilefields/type_string_test.php
+++ b/tests/profilefields/type_string_test.php
@@ -21,11 +21,11 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
 	protected $field_options;
 
 	/**
-	 * Sets up basic test objects
-	 *
-	 * @access public
-	 * @return null
-	 */
+	* Sets up basic test objects
+	*
+	* @access public
+	* @return null
+	*/
 	public function setUp()
 	{
 		global $request, $user, $cache;
@@ -147,8 +147,8 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
 	}
 
 	/**
-	 * @dataProvider validate_profile_field_data
-	 */
+	* @dataProvider validate_profile_field_data
+	*/
 	public function test_validate_profile_field($value, $field_options, $expected, $description)
 	{
 		$field_options = array_merge($this->field_options, $field_options);
@@ -190,8 +190,8 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
 
 
 	/**
-	 * @dataProvider profile_value_data
-	 */
+	* @dataProvider profile_value_data
+	*/
 	public function test_get_profile_value($value, $field_options, $expected, $description)
 	{
 		$field_options = array_merge($this->field_options, $field_options);
diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php
index 3dd32401a0..3ef2956531 100644
--- a/tests/profilefields/type_url_test.php
+++ b/tests/profilefields/type_url_test.php
@@ -19,11 +19,11 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
 	protected $field_options;
 
 	/**
-	 * Sets up basic test objects
-	 *
-	 * @access public
-	 * @return null
-	 */
+	* Sets up basic test objects
+	*
+	* @access public
+	* @return null
+	*/
 	public function setUp()
 	{
 		$user = $this->getMock('\phpbb\user');
@@ -93,8 +93,8 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
 	}
 
 	/**
-	 * @dataProvider validate_profile_field_data
-	 */
+	* @dataProvider validate_profile_field_data
+	*/
 	public function test_validate_profile_field($value, $field_options, $expected, $description)
 	{
 		$field_options = array_merge($this->field_options, $field_options);

From 3ac73a831a8ddb2a553a92e376452c625e722902 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Fri, 20 Jun 2014 14:41:59 +0530
Subject: [PATCH 27/28] [ticket/12514] Fix indention for type_url_test.php

PHPBB3-12514
---
 tests/profilefields/type_url_test.php | 46 +++++++++++++--------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php
index 3ef2956531..9957510d90 100644
--- a/tests/profilefields/type_url_test.php
+++ b/tests/profilefields/type_url_test.php
@@ -55,39 +55,39 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
 		return array(
 			array(
 				'',
-					array('field_required' => true),
-					'FIELD_INVALID_URL-field',
-					'Field should reject empty field that is required',
+				array('field_required' => true),
+				'FIELD_INVALID_URL-field',
+				'Field should reject empty field that is required',
 			),
 			array(
-					'invalidURL',
-					array(),
-					'FIELD_INVALID_URL-field',
-					'Field should reject invalid input',
+				'invalidURL',
+				array(),
+				'FIELD_INVALID_URL-field',
+				'Field should reject invalid input',
 			),
 			array(
-					'http://onetwothree.example.io',
-					array(),
-					false,
-					'Field should accept valid URL',
+				'http://onetwothree.example.io',
+				array(),
+				false,
+				'Field should accept valid URL',
 			),
 			array(
-					'http://example.com/index.html?param1=test&param2=awesome',
-					array(),
-					false,
-					'Field should accept valid URL',
+				'http://example.com/index.html?param1=test&param2=awesome',
+				array(),
+				false,
+				'Field should accept valid URL',
 			),
 			array(
-					'http://example.com/index.html/test/path?document=get',
-					array(),
-					false,
-					'Field should accept valid URL',
+				'http://example.com/index.html/test/path?document=get',
+				array(),
+				false,
+				'Field should accept valid URL',
 			),
 			array(
-					'http://example.com/index.html/test/path?document[]=DocType%20test&document[]=AnotherDoc',
-					array(),
-					'FIELD_INVALID_URL-field',
-					'Field should reject invalid URL having multi value parameters',
+				'http://example.com/index.html/test/path?document[]=DocType%20test&document[]=AnotherDoc',
+				array(),
+				'FIELD_INVALID_URL-field',
+				'Field should reject invalid URL having multi value parameters',
 			),
 		);
 	}

From 4472a492da3e61f48241a20a0408ebdc8444a966 Mon Sep 17 00:00:00 2001
From: Shitiz Garg <mail@dragooon.net>
Date: Fri, 20 Jun 2014 14:47:20 +0530
Subject: [PATCH 28/28] [ticket/12514] Fix array formatting for tests

PHPBB3-12514
---
 tests/profilefields/type_bool_test.php     |  24 ++--
 tests/profilefields/type_date_test.php     | 112 ++++++++--------
 tests/profilefields/type_dropdown_test.php |  80 ++++++------
 tests/profilefields/type_int_test.php      | 122 ++++++++---------
 tests/profilefields/type_string_test.php   | 144 ++++++++++-----------
 5 files changed, 241 insertions(+), 241 deletions(-)

diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php
index 03ce9445e1..29c118d57d 100644
--- a/tests/profilefields/type_bool_test.php
+++ b/tests/profilefields/type_bool_test.php
@@ -98,22 +98,22 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
 	{
 		return array(
 			array(
-					false,
-					array('field_show_novalue' => true),
-					'No',
-					'Field should output the default value',
+				false,
+				array('field_show_novalue' => true),
+				'No',
+				'Field should output the default value',
 			),
 			array(
-					false,
-					array('field_show_novalue' => false, 'field_length' => 2),
-					null,
-					'Field should not show anything for empty value',
+				false,
+				array('field_show_novalue' => false, 'field_length' => 2),
+				null,
+				'Field should not show anything for empty value',
 			),
 			array(
-					0,
-					array(),
-					'Yes',
-					'Field should show the set value',
+				0,
+				array(),
+				'Yes',
+				'Field should show the set value',
 			),
 		);
 	}
diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php
index 4c5dfce911..39fe95b97f 100644
--- a/tests/profilefields/type_date_test.php
+++ b/tests/profilefields/type_date_test.php
@@ -63,22 +63,22 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
 	{
 		return array(
 			array(
-					'01-01-2009',
-					array('field_show_novalue' => true),
-					'01/01/2009',
-					'Field should output the correctly formatted date',
+				'01-01-2009',
+				array('field_show_novalue' => true),
+				'01/01/2009',
+				'Field should output the correctly formatted date',
 			),
 			array(
-					null,
-					array('field_show_novalue' => false),
-					null,
-					'Field should leave empty value as is',
+				null,
+				array('field_show_novalue' => false),
+				null,
+				'Field should leave empty value as is',
 			),
 			array(
-					'None',
-					array('field_show_novalue' => true),
-					'None',
-					'Field should leave invalid value as is',
+				'None',
+				array('field_show_novalue' => true),
+				'None',
+				'Field should leave invalid value as is',
 			),
 		);
 	}
@@ -99,70 +99,70 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
 	{
 		return array(
 			array(
-					'',
-					array('field_required' => true),
-					'FIELD_REQUIRED-field',
-					'Field should reject value for being empty',
+				'',
+				array('field_required' => true),
+				'FIELD_REQUIRED-field',
+				'Field should reject value for being empty',
 			),
 			array(
-					'0125',
-					array('field_required' => true),
-					'FIELD_REQUIRED-field',
-					'Field should reject value for being invalid',
+				'0125',
+				array('field_required' => true),
+				'FIELD_REQUIRED-field',
+				'Field should reject value for being invalid',
 			),
 			array(
-					'01-01-2012',
-					array(),
-					false,
-					'Field should accept a valid value',
+				'01-01-2012',
+				array(),
+				false,
+				'Field should accept a valid value',
 			),
 			array(
-					'40-05-2009',
-					array(),
-					'FIELD_INVALID_DATE-field',
-					'Field should reject value for being invalid',
+				'40-05-2009',
+				array(),
+				'FIELD_INVALID_DATE-field',
+				'Field should reject value for being invalid',
 			),
 			array(
-					'12-30-2012',
-					array(),
-					'FIELD_INVALID_DATE-field',
-					'Field should reject value for being invalid',
+				'12-30-2012',
+				array(),
+				'FIELD_INVALID_DATE-field',
+				'Field should reject value for being invalid',
 			),
 			array(
-					'string',
-					array(),
-					false,
-					'Field should reject value for being invalid',
+				'string',
+				array(),
+				false,
+				'Field should reject value for being invalid',
 			),
 			array(
-					'string',
-					array('field_required' => true),
-					'FIELD_REQUIRED-field',
-					'Field should reject value for being invalid',
+				'string',
+				array('field_required' => true),
+				'FIELD_REQUIRED-field',
+				'Field should reject value for being invalid',
 			),
 			array(
-					100,
-					array(),
-					false,
-					'Field should reject value for being invalid',
+				100,
+				array(),
+				false,
+				'Field should reject value for being invalid',
 			),
 			array(
-					100,
-					array('field_required' => true),
-					'FIELD_REQUIRED-field',
-					'Field should reject value for being invalid',
+				100,
+				array('field_required' => true),
+				'FIELD_REQUIRED-field',
+				'Field should reject value for being invalid',
 			),
 			array(
-					null,
-					array('field_required' => true),
-					'FIELD_REQUIRED-field',
-					'Field should reject value for being empty',
+				null,
+				array('field_required' => true),
+				'FIELD_REQUIRED-field',
+				'Field should reject value for being empty',
 			),
 			array(
-					true,
-					array('field_required' => true),
-					'FIELD_REQUIRED-field',
-					'Field should reject value for being empty',
+				true,
+				array('field_required' => true),
+				'FIELD_REQUIRED-field',
+				'Field should reject value for being empty',
 			),
 		);
 	}
diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index d1983eb4cb..0e92afd504 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -77,40 +77,40 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
 	{
 		return array(
 			array(
-					7,
-					array(),
-					'FIELD_INVALID_VALUE-field',
-					'Invalid value should throw error',
+				7,
+				array(),
+				'FIELD_INVALID_VALUE-field',
+				'Invalid value should throw error',
 			),
 			array(
-					true,
-					array('field_required' => true),
-					false,
-					'Boolean would evaluate to 1 and hence correct value',
+				true,
+				array('field_required' => true),
+				false,
+				'Boolean would evaluate to 1 and hence correct value',
 			),
 			array(
-					'string',
-					array('field_required' => true),
-					'FIELD_REQUIRED-field',
-					'String should be rejected for value',
+				'string',
+				array('field_required' => true),
+				'FIELD_REQUIRED-field',
+				'String should be rejected for value',
 			),
 			array(
-					2,
-					array(),
-					false,
-					'Valid value should not throw error'
+				2,
+				array(),
+				false,
+				'Valid value should not throw error'
 			),
 			array(
-					0,
-					array(),
-					false,
-					'Empty value should be acceptible',
+				0,
+				array(),
+				false,
+				'Empty value should be acceptible',
 			),
 			array(
-					0,
-					array('field_required' => true),
-					'FIELD_REQUIRED-field',
-					'Required field should not accept empty value',
+				0,
+				array('field_required' => true),
+				'FIELD_REQUIRED-field',
+				'Required field should not accept empty value',
 			),
 		);
 	}
@@ -131,28 +131,28 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
 	{
 		return array(
 			array(
-					1,
-					array('field_show_novalue' => true),
-					'Option 1',
-					'Field should output the given value',
+				1,
+				array('field_show_novalue' => true),
+				'Option 1',
+				'Field should output the given value',
 			),
 			array(
-					4,
-					array('field_show_novalue' => false),
-					'Option 4',
-					'Field should output the given value',
+				4,
+				array('field_show_novalue' => false),
+				'Option 4',
+				'Field should output the given value',
 			),
 			array(
-					'',
-					array('field_show_novalue' => true),
-					'<No Value>',
-					'Field should output nothing for empty value',
+				'',
+				array('field_show_novalue' => true),
+				'<No Value>',
+				'Field should output nothing for empty value',
 			),
 			array(
-					'',
-					array('field_show_novalue' => false),
-					null,
-					'Field should simply output null for empty value',
+				'',
+				array('field_show_novalue' => false),
+				null,
+				'Field should simply output null for empty value',
 			),
 		);
 	}
diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php
index c43a20f59d..611edd32b9 100644
--- a/tests/profilefields/type_int_test.php
+++ b/tests/profilefields/type_int_test.php
@@ -52,60 +52,60 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
 	{
 		return array(
 			array(
-					'10',
-					array('field_show_novalue' => true),
-					10,
-					'Field should output integer value of given input',
+				'10',
+				array('field_show_novalue' => true),
+				10,
+				'Field should output integer value of given input',
 			),
 			array(
-					'0',
-					array('field_show_novalue' => true),
-					0,
-					'Field should output integer value of given input',
+				'0',
+				array('field_show_novalue' => true),
+				0,
+				'Field should output integer value of given input',
 			),
 			array(
-					'',
-					array('field_show_novalue' => true),
-					0,
-					'Field should translate empty value to 0 as integer',
-					false,
+				'',
+				array('field_show_novalue' => true),
+				0,
+				'Field should translate empty value to 0 as integer',
+				false,
 			),
 			array(
-					null,
-					array('field_show_novalue' => true),
-					0,
-					'Field should translate null value to 0 as integer',
+				null,
+				array('field_show_novalue' => true),
+				0,
+				'Field should translate null value to 0 as integer',
 			),
 			array(
-					'10',
-					array('field_show_novalue' => false),
-					10,
-					'Field should output integer value of given input',
+				'10',
+				array('field_show_novalue' => false),
+				10,
+				'Field should output integer value of given input',
 			),
 			array(
-					'0',
-					array('field_show_novalue' => false),
-					0,
-					'Field should output integer value of given input',
+				'0',
+				array('field_show_novalue' => false),
+				0,
+				'Field should output integer value of given input',
 			),
 			array(
-					'',
-					array('field_show_novalue' => false),
-					null,
-					'Field should leave empty value as is',
+				'',
+				array('field_show_novalue' => false),
+				null,
+				'Field should leave empty value as is',
 			),
 			array(
-					null,
-					array('field_show_novalue' => false),
-					null,
-					'Field should leave empty value as is',
+				null,
+				array('field_show_novalue' => false),
+				null,
+				'Field should leave empty value as is',
 			),
 		);
 	}
 
 	/**
-	 * @dataProvider profile_value_data
-	 */
+	* @dataProvider profile_value_data
+	*/
 	public function test_get_profile_value($value, $field_options, $expected, $description)
 	{
 		$field_options = array_merge($this->field_options, $field_options);
@@ -119,47 +119,47 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
 	{
 		return array(
 			array(
-					'15',
-					array('field_minlen' => 10, 'field_maxlen' => 20, 'field_required' => true),
-					false,
-					'Field should accept input of correct boundaries',
+				'15',
+				array('field_minlen' => 10, 'field_maxlen' => 20, 'field_required' => true),
+				false,
+				'Field should accept input of correct boundaries',
 			),
 			array(
-					'556476',
-					array('field_maxlen' => 50000, 'field_required' => true),
-					'FIELD_TOO_LARGE-50000-field',
-					'Field should reject value of greater value than max',
+				'556476',
+				array('field_maxlen' => 50000, 'field_required' => true),
+				'FIELD_TOO_LARGE-50000-field',
+				'Field should reject value of greater value than max',
 			),
 			array(
-					'9',
-					array('field_minlen' => 10, 'field_required' => true),
-					'FIELD_TOO_SMALL-10-field',
-					'Field should reject value which is less than defined minimum',
+				'9',
+				array('field_minlen' => 10, 'field_required' => true),
+				'FIELD_TOO_SMALL-10-field',
+				'Field should reject value which is less than defined minimum',
 			),
 			array(
-					true,
-					array('field_maxlen' => 20),
-					false,
-					'Field should accept correct boolean value',
+				true,
+				array('field_maxlen' => 20),
+				false,
+				'Field should accept correct boolean value',
 			),
 			array(
-					'string',
-					array('field_maxlen' => 10, 'field_required' => true),
-					false,
-					'Field should accept correct string value',
+				'string',
+				array('field_maxlen' => 10, 'field_required' => true),
+				false,
+				'Field should accept correct string value',
 			),
 			array(
-					null,
-					array('field_minlen' => 1, 'field_maxlen' => 10, 'field_required' => true),
-					'FIELD_TOO_SMALL-1-field',
-					'Field should not accept an empty value',
+				null,
+				array('field_minlen' => 1, 'field_maxlen' => 10, 'field_required' => true),
+				'FIELD_TOO_SMALL-1-field',
+				'Field should not accept an empty value',
 			),
 		);
 	}
 
 	/**
-	 * @dataProvider validate_profile_field_data
-	 */
+	* @dataProvider validate_profile_field_data
+	*/
 	public function test_validate_profile_field($value, $field_options, $expected, $description)
 	{
 		$field_options = array_merge($this->field_options, $field_options);
diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
index b796ef3073..d9a7369b94 100644
--- a/tests/profilefields/type_string_test.php
+++ b/tests/profilefields/type_string_test.php
@@ -60,88 +60,88 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
 	{
 		return array(
 			array(
-					'',
-					array('field_required' => true),
-					'FIELD_REQUIRED-field',
-					'Field should not accept empty values for required fields',
+				'',
+				array('field_required' => true),
+				'FIELD_REQUIRED-field',
+				'Field should not accept empty values for required fields',
 			),
 			array(
-					null,
-					array('field_required' => true),
-					'FIELD_REQUIRED-field',
-					'Field should not accept empty values for required field',
+				null,
+				array('field_required' => true),
+				'FIELD_REQUIRED-field',
+				'Field should not accept empty values for required field',
 			),
 			array(
-					0,
-					array('field_required' => true),
-					false,
-					'Field should accept a non-empty input',
+				0,
+				array('field_required' => true),
+				false,
+				'Field should accept a non-empty input',
 			),
 			array(
-					'false',
-					array('field_required' => true),
-					false,
-					'Field should accept a non-empty input',
+				'false',
+				array('field_required' => true),
+				false,
+				'Field should accept a non-empty input',
 			),
 			array(
-					10,
-					array('field_required' => true),
-					false,
-					'Field should accept a non-empty input',
+				10,
+				array('field_required' => true),
+				false,
+				'Field should accept a non-empty input',
 			),
 			array(
-					'tas',
-					array('field_minlen' => 2, 'field_maxlen' => 5),
-					false,
-					'Field should accept value of correct length',
+				'tas',
+				array('field_minlen' => 2, 'field_maxlen' => 5),
+				false,
+				'Field should accept value of correct length',
 			),
 			array(
-					't',
-					array('field_minlen' => 2, 'field_maxlen' => 5),
-					'FIELD_TOO_SHORT-2-field',
-					'Field should reject value of incorrect length',
+				't',
+				array('field_minlen' => 2, 'field_maxlen' => 5),
+				'FIELD_TOO_SHORT-2-field',
+				'Field should reject value of incorrect length',
 			),
 			array(
-					'this is a long string',
-					array('field_minlen' => 2, 'field_maxlen' => 5),
-					'FIELD_TOO_LONG-5-field',
-					'Field should reject value of incorrect length',
+				'this is a long string',
+				array('field_minlen' => 2, 'field_maxlen' => 5),
+				'FIELD_TOO_LONG-5-field',
+				'Field should reject value of incorrect length',
 			),
 			array(
-					'H3110',
-					array('field_validation' => '[0-9]+'),
-					'FIELD_INVALID_CHARS_NUMBERS_ONLY-field',
-					'Required field should reject characters in a numbers-only field',
+				'H3110',
+				array('field_validation' => '[0-9]+'),
+				'FIELD_INVALID_CHARS_NUMBERS_ONLY-field',
+				'Required field should reject characters in a numbers-only field',
 			),
 			array(
-					'&lt;&gt;&quot;&amp;%&amp;&gt;&lt;&gt;',
-					array('field_maxlen' => 10, 'field_minlen' => 2),
-					false,
-					'Optional field should accept html entities',
+				'&lt;&gt;&quot;&amp;%&amp;&gt;&lt;&gt;',
+				array('field_maxlen' => 10, 'field_minlen' => 2),
+				false,
+				'Optional field should accept html entities',
 			),
 			array(
-					'ö ä ü ß',
-					array(),
-					false,
-					'Required field should accept UTF-8 string',
+				'ö ä ü ß',
+				array(),
+				false,
+				'Required field should accept UTF-8 string',
 			),
 			array(
-					'This ö ä string has to b',
-					array('field_maxlen' => 10),
-					'FIELD_TOO_LONG-10-field',
-					'Required field should reject an UTF-8 string which is too long',
+				'This ö ä string has to b',
+				array('field_maxlen' => 10),
+				'FIELD_TOO_LONG-10-field',
+				'Required field should reject an UTF-8 string which is too long',
 			),
 			array(
-					'ö äö äö ä',
-					array('field_validation' => '[\w]+'),
-					'FIELD_INVALID_CHARS_ALPHA_ONLY-field',
-					'Required field should reject UTF-8 in alpha only field',
+				'ö äö äö ä',
+				array('field_validation' => '[\w]+'),
+				'FIELD_INVALID_CHARS_ALPHA_ONLY-field',
+				'Required field should reject UTF-8 in alpha only field',
 			),
 			array(
-					'Hello',
-					array('field_validation' => '[\w]+'),
-					false,
-					'Required field should accept a characters only field',
+				'Hello',
+				array('field_validation' => '[\w]+'),
+				false,
+				'Required field should accept a characters only field',
 			),
 		);
 	}
@@ -162,28 +162,28 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
 	{
 		return array(
 			array(
-					'test',
-					array('field_show_novalue' => true),
-					'test',
-					'Field should output the given value',
+				'test',
+				array('field_show_novalue' => true),
+				'test',
+				'Field should output the given value',
 			),
 			array(
-					'test',
-					array('field_show_novalue' => false),
-					'test',
-					'Field should output the given value',
+				'test',
+				array('field_show_novalue' => false),
+				'test',
+				'Field should output the given value',
 			),
 			array(
-					'',
-					array('field_show_novalue' => true),
-					'',
-					'Field should output nothing for empty value',
+				'',
+				array('field_show_novalue' => true),
+				'',
+				'Field should output nothing for empty value',
 			),
 			array(
-					'',
-					array('field_show_novalue' => false),
-					null,
-					'Field should simply output null for empty vlaue',
+				'',
+				array('field_show_novalue' => false),
+				null,
+				'Field should simply output null for empty vlaue',
 			),
 		);
 	}