From ce4926d000d1b89d1c84a1f61d0a720092149f55 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 6 Jul 2013 15:07:46 +0530 Subject: [ticket/11581] Add test to check UCP_PM is enabled/disabled correctly PHPBB3-11581 --- tests/functional/ucp_pm_test.php | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/functional/ucp_pm_test.php (limited to 'tests') diff --git a/tests/functional/ucp_pm_test.php b/tests/functional/ucp_pm_test.php new file mode 100644 index 0000000000..cba9e1690f --- /dev/null +++ b/tests/functional/ucp_pm_test.php @@ -0,0 +1,47 @@ +login(); + $this->admin_login(); + } + + public function test_pm_enabled() + { + $crawler = self::request('GET', 'ucp.php'); + $this->assertContainsLang('PRIVATE_MESSAGES', $crawler->filter('html')->text()); + } + + public function test_pm_disabled() + { + $this->set_allow_pm(0); + $crawler = self::request('GET', 'ucp.php'); + $this->assertNotContainsLang('PRIVATE_MESSAGES', $crawler->filter('html')->text()); + } + + protected function set_allow_pm($enable_pm) + { + $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=message'); + + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + + $values["config[allow_privmsg]"] = $enable_pm; + $form->setValues($values); + $crawler = self::submit($form); + $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); + } +} -- cgit v1.2.1