Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 21
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
phpbb_functional_acp_registration_test
0.00% covered (danger)
0.00%
0 / 21
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 1
 set_email_enable
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
6
 test_submitting_activation_method
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14/**
15* @group functional
16*/
17class phpbb_functional_acp_registration_test extends phpbb_functional_test_case
18{
19    protected function set_email_enable($db, $status)
20    {
21        $sql = "UPDATE phpbb_config
22            SET config_value = '" . (($status) ? '1' : '0') . "'
23            WHERE config_name = 'email_enable'";
24        $db->sql_query($sql);
25
26        $this->purge_cache();
27    }
28
29    public function test_submitting_activation_method()
30    {
31        $this->set_email_enable($this->db, false);
32
33        $this->add_lang('acp/board');
34        $this->login();
35        $this->admin_login();
36
37        $crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=registration&sid=' . $this->sid);
38        $this->assertContainsLang('ACP_REGISTER_SETTINGS_EXPLAIN', $this->get_content());
39
40        $form = $crawler->selectButton($this->lang('SUBMIT'))->form();
41        $form['config[require_activation]']->select(USER_ACTIVATION_ADMIN);
42        $crawler = self::submit($form);
43        $this->assertContainsLang('ACC_ACTIVATION_WARNING', $crawler->filter('div.main')->text());
44
45        $crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=registration&sid=' . $this->sid);
46        $form = $crawler->selectButton($this->lang('SUBMIT'))->form();
47        $form['config[require_activation]']->select(USER_ACTIVATION_NONE);
48        $crawler = self::submit($form);
49        $this->assertNotContainsLang('ACC_ACTIVATION_WARNING', $crawler->filter('div.main')->text());
50
51        $this->set_email_enable($this->db, true);
52    }
53}