aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional/acp_groups_test.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2013-06-04 20:26:35 +0200
committerMarc Alexander <admin@m-a-styles.de>2013-06-04 20:35:55 +0200
commit495b22632c489f08c46f6712f917e920911e5759 (patch)
tree9203347c7acfe12bb4993837be8bf35e31046e2b /tests/functional/acp_groups_test.php
parent0aa964786d8a6fc677ebd62cd7533fa3bf045730 (diff)
downloadforums-495b22632c489f08c46f6712f917e920911e5759.tar
forums-495b22632c489f08c46f6712f917e920911e5759.tar.gz
forums-495b22632c489f08c46f6712f917e920911e5759.tar.bz2
forums-495b22632c489f08c46f6712f917e920911e5759.tar.xz
forums-495b22632c489f08c46f6712f917e920911e5759.zip
[ticket/11587] Add functional tests for group teampage settings
The group_legend and group_teampage settings, which are needed for the teampage, are tested with these newly added functional tests. Duplicate code has been reduced as much as possible. PHPBB3-11587
Diffstat (limited to 'tests/functional/acp_groups_test.php')
-rw-r--r--tests/functional/acp_groups_test.php99
1 files changed, 99 insertions, 0 deletions
diff --git a/tests/functional/acp_groups_test.php b/tests/functional/acp_groups_test.php
index 3d8cabb086..56132e24fb 100644
--- a/tests/functional/acp_groups_test.php
+++ b/tests/functional/acp_groups_test.php
@@ -14,8 +14,107 @@ require_once dirname(__FILE__) . '/common_groups_test.php';
*/
class phpbb_functional_acp_groups_test extends phpbb_functional_common_groups_test
{
+ protected $form_data;
+
protected function get_url()
{
return 'adm/index.php?i=groups&mode=manage&action=edit';
}
+
+ public function acp_group_test_data()
+ {
+ return array(
+ 'both_yes' => array(
+ 5,
+ true,
+ true,
+ ),
+ 'legend_no_teampage' => array(
+ 5,
+ true,
+ false,
+ ),
+ 'no_legend_teampage' => array(
+ 5,
+ false,
+ true,
+ ),
+ 'both_no' => array(
+ 5,
+ false,
+ false,
+ ),
+ 'no_change' => array(
+ 5,
+ NULL,
+ NULL,
+ ),
+ 'back_to_default' => array(
+ 5,
+ true,
+ true,
+ ),
+ // Remove and add moderators back in order to reset
+ // group order to default one
+ 'mods_both_no' => array(
+ 4,
+ false,
+ false,
+ ),
+ 'mods_back_to_default' => array(
+ 4,
+ true,
+ true,
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider acp_group_test_data
+ */
+ public function test_acp_groups_teampage($group_id, $tick_legend, $tick_teampage)
+ {
+ $this->group_manage_login();
+
+ // Manage Administrators group
+ $form = $this->get_group_manage_form($group_id);
+ $this->form_data[0] = $form->getValues();
+
+ if (isset($tick_legend) && isset($tick_teampage))
+ {
+ if ($tick_legend)
+ {
+ $form['group_legend']->tick();
+ }
+ else
+ {
+ $form['group_legend']->untick();
+ }
+
+ if ($tick_teampage)
+ {
+ $form['group_teampage']->tick();
+ }
+ else
+ {
+ $form['group_teampage']->untick();
+ }
+ }
+ $crawler = $this->client->submit($form);
+ $this->assertContains($this->lang('GROUP_UPDATED'), $crawler->text());
+
+ $form = $this->get_group_manage_form($group_id);
+ if (!isset($tick_legend) && !isset($tick_teampage))
+ {
+ $this->form_data[1] = $form->getValues();
+ unset($this->form_data[0]['creation_time'], $this->form_data[0]['form_token'], $this->form_data[1]['creation_time'], $this->form_data[1]['form_token']);
+ $this->assertEquals($this->form_data[0], $this->form_data[1]);
+ }
+ else
+ {
+ $this->form_data = $form->getValues();
+ $this->assertEquals($tick_legend, $this->form_data['group_legend']);
+ $this->assertEquals($tick_teampage, $this->form_data['group_teampage']);
+ }
+ }
}