aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional')
-rw-r--r--tests/functional/acp_permissions_test.php6
-rw-r--r--tests/functional/common_avatar_test.php2
-rw-r--r--tests/functional/common_groups_test.php2
-rw-r--r--tests/functional/extension_controller_test.php12
-rw-r--r--tests/functional/extension_module_test.php4
-rw-r--r--tests/functional/fixtures/ext/foo/bar/acp/main_info.php6
-rw-r--r--tests/functional/fixtures/ext/foo/bar/acp/main_module.php4
-rw-r--r--tests/functional/fixtures/ext/foo/bar/config/services.yml2
-rw-r--r--tests/functional/fixtures/ext/foo/bar/controller/controller.php9
-rw-r--r--tests/functional/fixtures/ext/foo/bar/event/permission.php4
-rw-r--r--tests/functional/fixtures/ext/foo/bar/event/user_setup.php4
-rw-r--r--tests/functional/fixtures/ext/foo/bar/ext.php4
-rw-r--r--tests/functional/posting_test.php4
-rw-r--r--tests/functional/registration_test.php52
14 files changed, 90 insertions, 25 deletions
diff --git a/tests/functional/acp_permissions_test.php b/tests/functional/acp_permissions_test.php
index a3d272906f..e17f33dc96 100644
--- a/tests/functional/acp_permissions_test.php
+++ b/tests/functional/acp_permissions_test.php
@@ -91,12 +91,12 @@ class phpbb_functional_acp_permissions_test extends phpbb_functional_test_case
$crawler = self::request('GET', "adm/index.php?i=acp_permissions&icat=16&mode=$mode&${object_name}[0]=$object_id&type=$permission_type&sid=" . $this->sid);
$this->assertContains($this->lang('ACL_SET'), $crawler->filter('h1')->eq(1)->text());
- // XXX globals for phpbb_auth, refactor it later
+ // XXX globals for \phpbb\auth\auth, refactor it later
global $db, $cache;
$db = $this->get_db();
$cache = new phpbb_mock_null_cache;
- $auth = new phpbb_auth;
+ $auth = new \phpbb\auth\auth;
// XXX hardcoded id
$user_data = $auth->obtain_user_data(2);
$auth->acl($user_data);
@@ -114,7 +114,7 @@ class phpbb_functional_acp_permissions_test extends phpbb_functional_test_case
$this->assertContains($this->lang('AUTH_UPDATED'), $crawler->text());
// check acl again
- $auth = new phpbb_auth;
+ $auth = new \phpbb\auth\auth;
// XXX hardcoded id
$user_data = $auth->obtain_user_data(2);
$auth->acl($user_data);
diff --git a/tests/functional/common_avatar_test.php b/tests/functional/common_avatar_test.php
index c0f21d07c2..1fd8f2ed6f 100644
--- a/tests/functional/common_avatar_test.php
+++ b/tests/functional/common_avatar_test.php
@@ -32,7 +32,7 @@ abstract class phpbb_functional_common_avatar_test extends phpbb_functional_test
$crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid);
// Check the default entries we should have
$this->assertContainsLang('ALLOW_GRAVATAR', $crawler->text());
- $this->assertContainsLang('ALLOW_REMOTE', $crawler->text());
+ $this->assertContainsLang('ALLOW_REMOTE_UPLOAD', $crawler->text());
$this->assertContainsLang('ALLOW_AVATARS', $crawler->text());
$this->assertContainsLang('ALLOW_LOCAL', $crawler->text());
diff --git a/tests/functional/common_groups_test.php b/tests/functional/common_groups_test.php
index 6c6572af62..950db24767 100644
--- a/tests/functional/common_groups_test.php
+++ b/tests/functional/common_groups_test.php
@@ -43,7 +43,7 @@ abstract class phpbb_functional_common_groups_test extends phpbb_functional_test
$crawler = self::request('GET', 'adm/index.php?i=board&mode=avatar&sid=' . $this->sid);
// Check the default entries we should have
- $this->assertContains($this->lang('ALLOW_REMOTE'), $crawler->text());
+ $this->assertContains($this->lang('ALLOW_REMOTE_UPLOAD'), $crawler->text());
$this->assertContains($this->lang('ALLOW_AVATARS'), $crawler->text());
$this->assertContains($this->lang('ALLOW_LOCAL'), $crawler->text());
diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php
index 7d29f0000c..41bd48c204 100644
--- a/tests/functional/extension_controller_test.php
+++ b/tests/functional/extension_controller_test.php
@@ -52,7 +52,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
public function test_foo_bar()
{
$this->phpbb_extension_manager->enable('foo/bar');
- $crawler = self::request('GET', 'app.php?controller=foo/bar', array(), false);
+ $crawler = self::request('GET', 'app.php/foo/bar', array(), false);
self::assert_response_status_code();
$this->assertContains("foo/bar controller handle() method", $crawler->filter('body')->text());
$this->phpbb_extension_manager->purge('foo/bar');
@@ -64,7 +64,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
public function test_controller_with_template()
{
$this->phpbb_extension_manager->enable('foo/bar');
- $crawler = self::request('GET', 'app.php?controller=foo/template');
+ $crawler = self::request('GET', 'app.php/foo/template');
$this->assertContains("I am a variable", $crawler->filter('#content')->text());
$this->phpbb_extension_manager->purge('foo/bar');
}
@@ -76,9 +76,9 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
public function test_missing_argument()
{
$this->phpbb_extension_manager->enable('foo/bar');
- $crawler = self::request('GET', 'app.php?controller=foo/baz', array(), false);
+ $crawler = self::request('GET', 'app.php/foo/baz', array(), false);
$this->assert_response_html(500);
- $this->assertContains('Missing value for argument #1: test in class phpbb_ext_foo_bar_controller:baz', $crawler->filter('body')->text());
+ $this->assertContains('Missing value for argument #1: test in class foo\bar\controller\controller:baz', $crawler->filter('body')->text());
$this->phpbb_extension_manager->purge('foo/bar');
}
@@ -88,7 +88,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
public function test_exception_should_result_in_500_status_code()
{
$this->phpbb_extension_manager->enable('foo/bar');
- $crawler = self::request('GET', 'app.php?controller=foo/exception', array(), false);
+ $crawler = self::request('GET', 'app.php/foo/exception', array(), false);
$this->assert_response_html(500);
$this->assertContains('Exception thrown from foo/exception route', $crawler->filter('body')->text());
$this->phpbb_extension_manager->purge('foo/bar');
@@ -105,7 +105,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
*/
public function test_error_ext_disabled_or_404()
{
- $crawler = self::request('GET', 'app.php?controller=does/not/exist', array(), false);
+ $crawler = self::request('GET', 'app.php/does/not/exist', array(), false);
$this->assert_response_html(404);
$this->assertContains('No route found for "GET /does/not/exist"', $crawler->filter('body')->text());
}
diff --git a/tests/functional/extension_module_test.php b/tests/functional/extension_module_test.php
index c31a892ce9..090cd38daf 100644
--- a/tests/functional/extension_module_test.php
+++ b/tests/functional/extension_module_test.php
@@ -69,7 +69,7 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case
$modules->update_module_data($parent_data, true);
$module_data = array(
- 'module_basename' => 'phpbb_ext_foo_bar_acp_main_module',
+ 'module_basename' => 'foo\\bar\\acp\\main_module',
'module_enabled' => 1,
'module_display' => 1,
'parent_id' => $parent_data['module_id'],
@@ -90,7 +90,7 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case
{
$this->login();
$this->admin_login();
- $crawler = self::request('GET', 'adm/index.php?i=phpbb_ext_foo_bar_acp_main_module&mode=mode&sid=' . $this->sid);
+ $crawler = self::request('GET', 'adm/index.php?i=foo%5cbar%5cacp%5cmain_module&mode=mode&sid=' . $this->sid);
$this->assertContains("Bertie rulez!", $crawler->filter('#main')->text());
$this->phpbb_extension_manager->purge('foo/bar');
}
diff --git a/tests/functional/fixtures/ext/foo/bar/acp/main_info.php b/tests/functional/fixtures/ext/foo/bar/acp/main_info.php
index 21e38b09b5..2ad6d08503 100644
--- a/tests/functional/fixtures/ext/foo/bar/acp/main_info.php
+++ b/tests/functional/fixtures/ext/foo/bar/acp/main_info.php
@@ -8,6 +8,8 @@
*
*/
+namespace foo\bar\acp;
+
/**
* @ignore
*/
@@ -16,12 +18,12 @@ if (!defined('IN_PHPBB'))
exit;
}
-class phpbb_ext_foo_bar_acp_main_info
+class main_info
{
function module()
{
return array(
- 'filename' => 'phpbb_ext_foo_bar_acp_main_module',
+ 'filename' => 'foo\bar\acp\main_module',
'title' => 'ACP_FOOBAR_TITLE',
'version' => '1.0.0',
'modes' => array(
diff --git a/tests/functional/fixtures/ext/foo/bar/acp/main_module.php b/tests/functional/fixtures/ext/foo/bar/acp/main_module.php
index c4ab69fb38..c59b3c6820 100644
--- a/tests/functional/fixtures/ext/foo/bar/acp/main_module.php
+++ b/tests/functional/fixtures/ext/foo/bar/acp/main_module.php
@@ -8,6 +8,8 @@
*
*/
+namespace foo\bar\acp;
+
/**
* @ignore
*/
@@ -16,7 +18,7 @@ if (!defined('IN_PHPBB'))
exit;
}
-class phpbb_ext_foo_bar_acp_main_module
+class main_module
{
var $u_action;
diff --git a/tests/functional/fixtures/ext/foo/bar/config/services.yml b/tests/functional/fixtures/ext/foo/bar/config/services.yml
index 33ced55af9..3bca4c6567 100644
--- a/tests/functional/fixtures/ext/foo/bar/config/services.yml
+++ b/tests/functional/fixtures/ext/foo/bar/config/services.yml
@@ -1,6 +1,6 @@
services:
foo_bar.controller:
- class: phpbb_ext_foo_bar_controller
+ class: foo\bar\controller\controller
arguments:
- @controller.helper
- @template
diff --git a/tests/functional/fixtures/ext/foo/bar/controller/controller.php b/tests/functional/fixtures/ext/foo/bar/controller/controller.php
index 5a91b5f681..259d548299 100644
--- a/tests/functional/fixtures/ext/foo/bar/controller/controller.php
+++ b/tests/functional/fixtures/ext/foo/bar/controller/controller.php
@@ -1,11 +1,14 @@
<?php
+
+namespace foo\bar\controller;
+
use Symfony\Component\HttpFoundation\Response;
-class phpbb_ext_foo_bar_controller
+class controller
{
protected $template;
- public function __construct(phpbb_controller_helper $helper, phpbb_template $template)
+ public function __construct(\phpbb\controller\helper $helper, \phpbb\template\template $template)
{
$this->template = $template;
$this->helper = $helper;
@@ -30,6 +33,6 @@ class phpbb_ext_foo_bar_controller
public function exception()
{
- throw new phpbb_controller_exception('Exception thrown from foo/exception route');
+ throw new \phpbb\controller\exception('Exception thrown from foo/exception route');
}
}
diff --git a/tests/functional/fixtures/ext/foo/bar/event/permission.php b/tests/functional/fixtures/ext/foo/bar/event/permission.php
index 48688a586a..92e24074ad 100644
--- a/tests/functional/fixtures/ext/foo/bar/event/permission.php
+++ b/tests/functional/fixtures/ext/foo/bar/event/permission.php
@@ -8,6 +8,8 @@
*
*/
+namespace foo\bar\event;
+
/**
* @ignore
*/
@@ -22,7 +24,7 @@ if (!defined('IN_PHPBB'))
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-class phpbb_ext_foo_bar_event_permission implements EventSubscriberInterface
+class permission implements EventSubscriberInterface
{
static public function getSubscribedEvents()
{
diff --git a/tests/functional/fixtures/ext/foo/bar/event/user_setup.php b/tests/functional/fixtures/ext/foo/bar/event/user_setup.php
index 3d2d0c5325..1409f97470 100644
--- a/tests/functional/fixtures/ext/foo/bar/event/user_setup.php
+++ b/tests/functional/fixtures/ext/foo/bar/event/user_setup.php
@@ -8,6 +8,8 @@
*
*/
+namespace foo\bar\event;
+
/**
* @ignore
*/
@@ -22,7 +24,7 @@ if (!defined('IN_PHPBB'))
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-class phpbb_ext_foo_bar_event_user_setup implements EventSubscriberInterface
+class user_setup implements EventSubscriberInterface
{
static public function getSubscribedEvents()
{
diff --git a/tests/functional/fixtures/ext/foo/bar/ext.php b/tests/functional/fixtures/ext/foo/bar/ext.php
index 74359d51ab..1288edd5ec 100644
--- a/tests/functional/fixtures/ext/foo/bar/ext.php
+++ b/tests/functional/fixtures/ext/foo/bar/ext.php
@@ -1,6 +1,8 @@
<?php
-class phpbb_ext_foo_bar_ext extends phpbb_extension_base
+namespace foo\bar;
+
+class ext extends \phpbb\extension\base
{
}
diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php
index 7fd1e4fdcf..dd95704952 100644
--- a/tests/functional/posting_test.php
+++ b/tests/functional/posting_test.php
@@ -22,8 +22,8 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
$crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}");
$this->assertContains('This is a test topic posted by the testing framework.', $crawler->filter('html')->text());
- // Test creating a reply
- $post2 = $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test post posted by the testing framework.');
+ // Test creating a reply with bbcode
+ $post2 = $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test [b]post[/b] posted by the testing framework.');
$crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}");
$this->assertContains('This is a test post posted by the testing framework.', $crawler->filter('html')->text());
diff --git a/tests/functional/registration_test.php b/tests/functional/registration_test.php
new file mode 100644
index 0000000000..5baf33c59e
--- /dev/null
+++ b/tests/functional/registration_test.php
@@ -0,0 +1,52 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @group functional
+*/
+class phpbb_functional_registration_test extends phpbb_functional_test_case
+{
+ public function test_disable_captcha_on_registration()
+ {
+ $this->login();
+ $this->admin_login();
+
+ $crawler = self::request('GET', "adm/index.php?i=acp_board&mode=registration&sid={$this->sid}");
+ $form = $crawler->selectButton('Submit')->form();
+ $form['config[enable_confirm]']->setValue('0');
+ $crawler = self::submit($form);
+
+ $this->assertContainsLang('CONFIG_UPDATED', $crawler->filter('#main .successbox')->text());
+ }
+
+ /**
+ * @depends test_disable_captcha_on_registration
+ */
+ public function test_register_new_account()
+ {
+ $this->add_lang('ucp');
+
+ $crawler = self::request('GET', 'ucp.php?mode=register');
+ $this->assertContainsLang('REGISTRATION', $crawler->filter('div.content h2')->text());
+
+ $form = $crawler->selectButton('I agree to these terms')->form();
+ $crawler = self::submit($form);
+
+ $form = $crawler->selectButton('Submit')->form(array(
+ 'username' => 'user-reg-test',
+ 'email' => 'user-reg-test@phpbb.com',
+ 'new_password' => 'testtest',
+ 'password_confirm' => 'testtest',
+ ));
+ $form['tz']->select('Europe/Berlin');
+ $crawler = self::submit($form);
+
+ $this->assertContainsLang('ACCOUNT_ADDED', $crawler->filter('#message')->text());
+ }
+}