aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2013-12-07 13:32:19 +0100
committerMarc Alexander <admin@m-a-styles.de>2013-12-07 13:32:19 +0100
commit47ea6bc9e61c71f6d54df848b6c61ace052d9e2a (patch)
tree9a4181d1c3c2d045abc1575634480d2ab5b1a634 /tests/functional
parentf32a30eecacba212850a11b7b4740d0a69bd49de (diff)
parent71169de8230812f2d05b87bfba42331e04663b81 (diff)
downloadforums-47ea6bc9e61c71f6d54df848b6c61ace052d9e2a.tar
forums-47ea6bc9e61c71f6d54df848b6c61ace052d9e2a.tar.gz
forums-47ea6bc9e61c71f6d54df848b6c61ace052d9e2a.tar.bz2
forums-47ea6bc9e61c71f6d54df848b6c61ace052d9e2a.tar.xz
forums-47ea6bc9e61c71f6d54df848b6c61ace052d9e2a.zip
Merge branch 'develop' of https://github.com/phpbb/phpbb into ticket/11997
Conflicts: tests/functional/fixtures/ext/foo/bar/config/services.yml
Diffstat (limited to 'tests/functional')
-rw-r--r--tests/functional/avatar_acp_groups_test.php9
-rw-r--r--tests/functional/extension_acp_test.php21
-rw-r--r--tests/functional/extension_controller_test.php2
-rw-r--r--tests/functional/extension_global_lang_test.php3
-rw-r--r--tests/functional/extension_module_test.php45
-rw-r--r--tests/functional/extension_permission_lang_test.php3
-rw-r--r--tests/functional/fixtures/ext/foo/bar/composer.json2
-rw-r--r--tests/functional/fixtures/ext/foo/bar/config/services.yml9
-rw-r--r--tests/functional/fixtures/ext/foo/bar/event/permission.php9
-rw-r--r--tests/functional/fixtures/ext/foo/bar/event/user_setup.php9
-rw-r--r--tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/foobar.html3
-rw-r--r--tests/functional/fixtures/ext/foo/bar/ucp/main_info.php26
-rw-r--r--tests/functional/fixtures/ext/foo/bar/ucp/main_module.php22
-rw-r--r--tests/functional/group_create_test.php31
-rw-r--r--tests/functional/notification_test.php33
15 files changed, 201 insertions, 26 deletions
diff --git a/tests/functional/avatar_acp_groups_test.php b/tests/functional/avatar_acp_groups_test.php
index 5e908bc6da..5f767b44f2 100644
--- a/tests/functional/avatar_acp_groups_test.php
+++ b/tests/functional/avatar_acp_groups_test.php
@@ -69,4 +69,13 @@ class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_av
{
$this->assert_avatar_submit($expected, $avatar_type, $data);
}
+
+ // Test if avatar was really deleted
+ public function test_no_avatar_acp_groups()
+ {
+ $crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid);
+ $form = $crawler->selectButton($this->lang('SUBMIT'))->form();
+ $form_data = $form->getValues();
+ $this->assertEmpty($form_data['avatar_type']);
+ }
}
diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php
index 44bb895f67..5d391e42f7 100644
--- a/tests/functional/extension_acp_test.php
+++ b/tests/functional/extension_acp_test.php
@@ -182,13 +182,34 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
public function test_actions()
{
+ // Access enable page without hash
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable&ext_name=vendor%2Fmoo&sid=' . $this->sid);
+ $this->assertContainsLang('FORM_INVALID', $crawler->filter('.errorbox')->text());
+
+ // Correctly submit the enable form
+ $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
+ $form = $crawler->selectButton('enable')->form();
+ $crawler = self::submit($form);
$this->assertContainsLang('EXTENSION_ENABLE_SUCCESS', $crawler->filter('.successbox')->text());
+ // Access disable page without hash
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable&ext_name=vendor%2Fmoo&sid=' . $this->sid);
+ $this->assertContainsLang('FORM_INVALID', $crawler->filter('.errorbox')->text());
+
+ // Correctly submit the disable form
+ $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
+ $form = $crawler->selectButton('disable')->form();
+ $crawler = self::submit($form);
$this->assertContainsLang('EXTENSION_DISABLE_SUCCESS', $crawler->filter('.successbox')->text());
+ // Access delete_data page without hash
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data&ext_name=vendor%2Fmoo&sid=' . $this->sid);
+ $this->assertContainsLang('FORM_INVALID', $crawler->filter('.errorbox')->text());
+
+ // Correctly submit the delete data form
+ $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
+ $form = $crawler->selectButton('delete_data')->form();
+ $crawler = self::submit($form);
$this->assertContainsLang('EXTENSION_DELETE_DATA_SUCCESS', $crawler->filter('.successbox')->text());
}
}
diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php
index fe21ec5bd8..ab90223c48 100644
--- a/tests/functional/extension_controller_test.php
+++ b/tests/functional/extension_controller_test.php
@@ -19,6 +19,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
static protected $fixtures = array(
'foo/bar/config/',
'foo/bar/controller/',
+ 'foo/bar/event/',
+ 'foo/bar/language/en/',
'foo/bar/styles/prosilver/template/',
);
diff --git a/tests/functional/extension_global_lang_test.php b/tests/functional/extension_global_lang_test.php
index fb8f87e6de..094eda8257 100644
--- a/tests/functional/extension_global_lang_test.php
+++ b/tests/functional/extension_global_lang_test.php
@@ -17,8 +17,9 @@ class phpbb_functional_extension_global_lang_test extends phpbb_functional_test_
static private $helper;
static protected $fixtures = array(
- 'foo/bar/language/en/',
+ 'foo/bar/config/',
'foo/bar/event/',
+ 'foo/bar/language/en/',
);
static public function setUpBeforeClass()
diff --git a/tests/functional/extension_module_test.php b/tests/functional/extension_module_test.php
index 090cd38daf..ba025d582e 100644
--- a/tests/functional/extension_module_test.php
+++ b/tests/functional/extension_module_test.php
@@ -80,18 +80,53 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case
);
$modules->update_module_data($module_data, true);
+ $parent_data = array(
+ 'module_basename' => '',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => 0,
+ 'module_class' => 'ucp',
+ 'module_langname' => 'UCP_FOOBAR_TITLE',
+ 'module_mode' => '',
+ 'module_auth' => '',
+ );
+ $modules->update_module_data($parent_data, true);
+
+ $module_data = array(
+ 'module_basename' => 'foo\\bar\\ucp\\main_module',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $parent_data['module_id'],
+ 'module_class' => 'ucp',
+ 'module_langname' => 'UCP_FOOBAR_TITLE',
+ 'module_mode' => 'mode',
+ 'module_auth' => '',
+ );
+ $modules->update_module_data($module_data, true);
+
$this->purge_cache();
}
- /**
- * Check a controller for extension foo/bar.
- */
- public function test_foo_bar()
+ public function test_acp()
{
$this->login();
$this->admin_login();
+
$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->assertContains('Bertie rulez!', $crawler->filter('#main')->text());
+ }
+
+ public function test_ucp()
+ {
+ $this->login();
+
+ $crawler = self::request('GET', 'ucp.php?sid=' . $this->sid);
+ $this->assertContains('UCP_FOOBAR_TITLE', $crawler->filter('#tabs')->text());
+
+ $link = $crawler->selectLink('UCP_FOOBAR_TITLE')->link()->getUri();
+ $crawler = self::request('GET', substr($link, strpos($link, 'ucp.')));
+ $this->assertContains('UCP Extension Template Test Passed!', $crawler->filter('#content')->text());
+
$this->phpbb_extension_manager->purge('foo/bar');
}
}
diff --git a/tests/functional/extension_permission_lang_test.php b/tests/functional/extension_permission_lang_test.php
index 19adb89819..e922abdaf1 100644
--- a/tests/functional/extension_permission_lang_test.php
+++ b/tests/functional/extension_permission_lang_test.php
@@ -17,8 +17,9 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t
static private $helper;
static protected $fixtures = array(
- 'foo/bar/language/en/',
+ 'foo/bar/config/',
'foo/bar/event/',
+ 'foo/bar/language/en/',
);
static public function setUpBeforeClass()
diff --git a/tests/functional/fixtures/ext/foo/bar/composer.json b/tests/functional/fixtures/ext/foo/bar/composer.json
index cb9dbc9514..e3e5fc21cd 100644
--- a/tests/functional/fixtures/ext/foo/bar/composer.json
+++ b/tests/functional/fixtures/ext/foo/bar/composer.json
@@ -14,7 +14,7 @@
}],
"require": {
"php": ">=5.3",
- "phpbb": "3.1.*@dev"
+ "phpbb/phpbb": "3.1.*@dev"
},
"extra": {
"display-name": "phpBB 3.1 Extension Testing"
diff --git a/tests/functional/fixtures/ext/foo/bar/config/services.yml b/tests/functional/fixtures/ext/foo/bar/config/services.yml
index d7012dee1c..13aadf9768 100644
--- a/tests/functional/fixtures/ext/foo/bar/config/services.yml
+++ b/tests/functional/fixtures/ext/foo/bar/config/services.yml
@@ -6,3 +6,12 @@ services:
- @template
- %core.root_path%
- %core.php_ext%
+
+ foo_bar.listener.permission:
+ class: foo\bar\event\permission
+ tags:
+ - { name: event.listener }
+ foo_bar.listener.user_setup:
+ class: foo\bar\event\user_setup
+ tags:
+ - { name: event.listener }
diff --git a/tests/functional/fixtures/ext/foo/bar/event/permission.php b/tests/functional/fixtures/ext/foo/bar/event/permission.php
index 92e24074ad..9b319dd35f 100644
--- a/tests/functional/fixtures/ext/foo/bar/event/permission.php
+++ b/tests/functional/fixtures/ext/foo/bar/event/permission.php
@@ -11,15 +11,6 @@
namespace foo\bar\event;
/**
-* @ignore
-*/
-
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
* Event listener
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
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 1409f97470..8fa7ac97da 100644
--- a/tests/functional/fixtures/ext/foo/bar/event/user_setup.php
+++ b/tests/functional/fixtures/ext/foo/bar/event/user_setup.php
@@ -11,15 +11,6 @@
namespace foo\bar\event;
/**
-* @ignore
-*/
-
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
* Event listener
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
diff --git a/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/foobar.html b/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/foobar.html
new file mode 100644
index 0000000000..cbded623f4
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/foobar.html
@@ -0,0 +1,3 @@
+<!-- INCLUDE overall_header.html -->
+<div id="content">UCP Extension Template Test Passed!</div>
+<!-- INCLUDE overall_footer.html -->
diff --git a/tests/functional/fixtures/ext/foo/bar/ucp/main_info.php b/tests/functional/fixtures/ext/foo/bar/ucp/main_info.php
new file mode 100644
index 0000000000..2ba37f3050
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/bar/ucp/main_info.php
@@ -0,0 +1,26 @@
+<?php
+
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace foo\bar\ucp;
+
+class main_info
+{
+ function module()
+ {
+ return array(
+ 'filename' => '\foo\bar\ucp\main_module',
+ 'title' => 'ACP_FOOBAR_TITLE',
+ 'version' => '1.0.0',
+ 'modes' => array(
+ 'mode' => array('title' => 'ACP_FOOBAR_MODE', 'auth' => '', 'cat' => array('ACP_FOOBAR_TITLE')),
+ ),
+ );
+ }
+}
diff --git a/tests/functional/fixtures/ext/foo/bar/ucp/main_module.php b/tests/functional/fixtures/ext/foo/bar/ucp/main_module.php
new file mode 100644
index 0000000000..cd3dacc9db
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/bar/ucp/main_module.php
@@ -0,0 +1,22 @@
+<?php
+
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace foo\bar\ucp;
+
+class main_module
+{
+ var $u_action;
+
+ function main($id, $mode)
+ {
+ $this->tpl_name = 'foobar';
+ $this->page_title = 'Bertie';
+ }
+}
diff --git a/tests/functional/group_create_test.php b/tests/functional/group_create_test.php
new file mode 100644
index 0000000000..96780069f7
--- /dev/null
+++ b/tests/functional/group_create_test.php
@@ -0,0 +1,31 @@
+<?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_group_create_test extends phpbb_functional_test_case
+{
+
+ public function test_create_group()
+ {
+ $this->login();
+ $this->admin_login();
+ $this->add_lang('acp/groups');
+
+ $crawler = self::request('GET', 'adm/index.php?i=acp_groups&mode=manage&sid=' . $this->sid);
+ $form = $crawler->selectButton($this->lang('SUBMIT'))->form();
+ $crawler = self::submit($form, array('group_name' => 'testtest'));
+
+ $form = $crawler->selectButton($this->lang('SUBMIT'))->form();
+ $crawler = self::submit($form, array('group_name' => 'testtest'));
+
+ $this->assertContainsLang('GROUP_CREATED', $crawler->filter('#main')->text());
+ }
+}
diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php
index 7f33ad1859..dd1b8ec981 100644
--- a/tests/functional/notification_test.php
+++ b/tests/functional/notification_test.php
@@ -52,4 +52,37 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case
$this->assert_checkbox_is_unchecked($cplist, $checkbox_name);
}
}
+
+ public function test_mark_notifications_read()
+ {
+ // Create a new standard user
+ $this->create_user('notificationtestuser');
+ $this->add_user_group('NEWLY_REGISTERED', array('notificationtestuser'));
+ $this->login('notificationtestuser');
+ $crawler = self::request('GET', 'index.php');
+ $this->assertContains('notificationtestuser', $crawler->filter('.icon-logout')->text());
+
+ // Post a new post that needs approval
+ $this->create_post(2, 1, 'Re: Welcome to phpBB3', 'This is a test [b]post[/b] posted by notificationtestuser.', array(), 'POST_STORED_MOD');
+ $crawler = self::request('GET', "viewtopic.php?t=1&sid={$this->sid}");
+ $this->assertNotContains('This is a test post posted by notificationtestuser.', $crawler->filter('html')->text());
+
+ // logout
+ $crawler = self::request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout');
+
+ // admin login
+ $this->login();
+ $this->add_lang('ucp');
+ $crawler = self::request('GET', 'ucp.php?i=ucp_notifications');
+
+ // At least one notification should exist
+ $this->assertGreaterThan(0, $crawler->filter('#notification_list_button strong')->text());
+
+ // Get form token
+ $link = $crawler->selectLink($this->lang('NOTIFICATIONS_MARK_ALL_READ'))->link()->getUri();
+ $crawler = self::request('GET', substr($link, strpos($link, 'ucp.')));
+ $form = $crawler->selectButton($this->lang('YES'))->form();
+ $crawler = self::submit($form);
+ $this->assertEquals(0, $crawler->filter('#notification_list_button strong')->text());
+ }
}