aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-09-05 13:32:44 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-09-06 15:16:51 +0200
commit647a75249c83908acd1d23e1aa71d9119a4510a8 (patch)
tree8c174620b91d6ff820d0ae9874e0d529918e54bb /tests
parentb9cb3b9e3ed17c2cf8737767ce7d67ed966216b5 (diff)
downloadforums-647a75249c83908acd1d23e1aa71d9119a4510a8.tar
forums-647a75249c83908acd1d23e1aa71d9119a4510a8.tar.gz
forums-647a75249c83908acd1d23e1aa71d9119a4510a8.tar.bz2
forums-647a75249c83908acd1d23e1aa71d9119a4510a8.tar.xz
forums-647a75249c83908acd1d23e1aa71d9119a4510a8.zip
[ticket/12983] Add functional test for ucp pref module
PHPBB3-12983
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/ucp_preferences_test.php67
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/functional/ucp_preferences_test.php b/tests/functional/ucp_preferences_test.php
new file mode 100644
index 0000000000..c904f5af06
--- /dev/null
+++ b/tests/functional/ucp_preferences_test.php
@@ -0,0 +1,67 @@
+<?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.
+*
+*/
+
+/**
+* @group functional
+*/
+class phpbb_functional_ucp_preferences_test extends phpbb_functional_test_case
+{
+ public function test_submitting_profile_info()
+ {
+ $this->add_lang('ucp');
+ $this->login();
+
+ $crawler = self::request('GET', 'ucp.php?i=ucp_prefs&mode=view');
+ $this->assertContainsLang('UCP_PREFS_VIEW', $crawler->filter('#cp-main h2')->text());
+
+ $form = $crawler->selectButton('Submit')->form(array(
+ 'topic_sk' => 'a',
+ 'topic_sd' => 'a',
+ 'topic_st' => '1',
+ 'post_sk' => 'a',
+ 'post_sd' => 'a',
+ 'post_st' => '1',
+ ));
+
+ $crawler = self::submit($form);
+ $this->assertContainsLang('PREFERENCES_UPDATED', $crawler->filter('#message')->text());
+
+ $crawler = self::request('GET', 'ucp.php?i=ucp_prefs&mode=view');
+ $this->assertContainsLang('UCP_PREFS_VIEW', $crawler->filter('#cp-main h2')->text());
+
+ $form = $crawler->selectButton('Submit')->form(array(
+ 'topic_sk' => 'z',
+ 'topic_sd' => 'z',
+ 'topic_st' => 'test',
+ 'post_sk' => 'z',
+ 'post_sd' => 'z',
+ 'post_st' => 'test',
+ ));
+
+ $crawler = self::submit($form);
+ $this->assertContainsLang('WRONG_DATA_POST_SD', $crawler->filter('#cp-main')->text());
+ $this->assertContainsLang('WRONG_DATA_POST_SK', $crawler->filter('#cp-main')->text());
+ $this->assertContainsLang('WRONG_DATA_TOPIC_SD', $crawler->filter('#cp-main')->text());
+ $this->assertContainsLang('WRONG_DATA_TOPIC_SK', $crawler->filter('#cp-main')->text());
+
+ $crawler = self::request('GET', 'ucp.php?i=ucp_prefs&mode=view');
+ $form = $crawler->selectButton('Submit')->form();
+
+ $this->assertEquals('a', $form->get('topic_sk')->getValue());
+ $this->assertEquals('a', $form->get('topic_sd')->getValue());
+ $this->assertEquals('1', $form->get('topic_st')->getValue());
+ $this->assertEquals('a', $form->get('post_sk')->getValue());
+ $this->assertEquals('a', $form->get('post_sd')->getValue());
+ $this->assertEquals('1', $form->get('post_st')->getValue());
+ }
+}