aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/content_visibility/delete_post_test.php4
-rw-r--r--tests/functional/ucp_profile_test.php10
-rw-r--r--tests/profilefields/type_string_test.php24
3 files changed, 37 insertions, 1 deletions
diff --git a/tests/content_visibility/delete_post_test.php b/tests/content_visibility/delete_post_test.php
index e0a2a3d402..99068729df 100644
--- a/tests/content_visibility/delete_post_test.php
+++ b/tests/content_visibility/delete_post_test.php
@@ -266,7 +266,7 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
*/
public function test_delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason, $expected_posts, $expected_topic, $expected_forum)
{
- global $auth, $cache, $config, $db, $phpbb_container, $phpbb_root_path, $phpEx;
+ global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
$config['search_type'] = 'phpbb_mock_search';
$cache = new phpbb_mock_cache;
@@ -283,6 +283,8 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
)));
$user = $this->getMock('\phpbb\user');
+ $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
+
$phpbb_container = new phpbb_mock_container_builder();
$phpbb_container->set('notification_manager', new phpbb_mock_notification_manager());
$phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE));
diff --git a/tests/functional/ucp_profile_test.php b/tests/functional/ucp_profile_test.php
index ea08eece78..2d68704162 100644
--- a/tests/functional/ucp_profile_test.php
+++ b/tests/functional/ucp_profile_test.php
@@ -25,13 +25,23 @@ class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case
$this->assertContainsLang('UCP_PROFILE_PROFILE_INFO', $crawler->filter('#cp-main h2')->text());
$form = $crawler->selectButton('Submit')->form(array(
+ 'pf_phpbb_facebook' => 'phpbb',
'pf_phpbb_location' => 'Bertie“s Empire',
+ 'pf_phpbb_skype' => 'phpbb.skype.account',
+ 'pf_phpbb_twitter' => 'phpbb_twitter',
+ 'pf_phpbb_youtube' => 'phpbb.youtube',
));
+
$crawler = self::submit($form);
$this->assertContainsLang('PROFILE_UPDATED', $crawler->filter('#message')->text());
$crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=profile_info');
$form = $crawler->selectButton('Submit')->form();
+
+ $this->assertEquals('phpbb', $form->get('pf_phpbb_facebook')->getValue());
$this->assertEquals('Bertie“s Empire', $form->get('pf_phpbb_location')->getValue());
+ $this->assertEquals('phpbb.skype.account', $form->get('pf_phpbb_skype')->getValue());
+ $this->assertEquals('phpbb_twitter', $form->get('pf_phpbb_twitter')->getValue());
+ $this->assertEquals('phpbb.youtube', $form->get('pf_phpbb_youtube')->getValue());
}
}
diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
index d9a7369b94..cee8a1d863 100644
--- a/tests/profilefields/type_string_test.php
+++ b/tests/profilefields/type_string_test.php
@@ -143,6 +143,30 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
false,
'Required field should accept a characters only field',
),
+ array(
+ 'Valid.Username123',
+ array('field_validation' => '[\w.]+'),
+ false,
+ 'Required field should accept a alphanumeric field with dots',
+ ),
+ array(
+ 'Invalid.,username123',
+ array('field_validation' => '[\w.]+'),
+ 'FIELD_INVALID_CHARS_ALPHA_DOTS-field',
+ 'Required field should reject field with comma',
+ ),
+ array(
+ 'skype.test.name,_this',
+ array('field_validation' => '[a-zA-Z][\w\.,\-_]+'),
+ false,
+ 'Required field should accept alphanumeric field with punctuations',
+ ),
+ array(
+ '1skype.this.should.faila',
+ array('field_validation' => '[a-zA-Z][\w\.,\-_]+'),
+ 'FIELD_INVALID_CHARS_ALPHA_PUNCTUATION-field',
+ 'Required field should reject field having invalid input for the given validation',
+ ),
);
}