1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 03:04:09 +02:00

Merge remote-tracking branch 'github-phpbb/develop' into ticket/11700

* github-phpbb/develop: (586 commits)
  [ticket/11735] Display disabled checkbox in subsilver for read notifications
  [ticket/11735] Display disabled checkbox when notification is already read
  [ticket/11844] update acp/authentication language var
  [ticket/11795] Remove PM popup
  [ticket/11795] Remove outdated comment from forum_fn.js
  [ticket/11795] Move find user JS to forum_fn
  [ticket/11795] Replace TWIG with phpBB syntax in ACP
  [ticket/11795] Move MSN scripts to forum_fn.js
  [ticket/11795] Use phpBB template syntax instead of TWIG
  [ticket/11795] Move PM popup JS to forum_fn.js
  [ticket/11795] Get rid of pagination JS variables
  [ticket/11795] Get rid of onload_functions
  [ticket/11795] Use data-reset-on-edit attr to reset elements
  [ticket/11795] Redo form elements auto-focus
  [ticket/11811] Remove outline on :focus
  [ticket/11836] Fix subsilver fatal error
  [ticket/11837] Replace escaped single quote with utf-8 single quote
  [ticket/11836] Fix fatal error on unsupported provider for auth link
  [ticket/11837] Translate UCP_AUTH_LINK_NOT_SUPPORTED
  [ticket/11809] Ensure code.js is first script included after jQuery
  ...

Conflicts:
	phpBB/config/services.yml
	phpBB/develop/create_schema_files.php
	phpBB/develop/mysql_upgrader.php
	phpBB/download/file.php
	phpBB/includes/bbcode.php
	phpBB/includes/functions_container.php
	phpBB/install/database_update.php
	phpBB/install/index.php
	phpBB/phpbb/controller/helper.php
	phpBB/phpbb/controller/resolver.php
	phpBB/phpbb/request/request_interface.php
	phpBB/phpbb/session.php
	phpBB/phpbb/style/extension_path_provider.php
	phpBB/phpbb/style/path_provider.php
	phpBB/phpbb/style/path_provider_interface.php
	phpBB/phpbb/style/resource_locator.php
	phpBB/phpbb/style/style.php
	phpBB/phpbb/template/locator.php
	phpBB/phpbb/template/template.php
	phpBB/phpbb/template/twig/node/includeasset.php
	phpBB/phpbb/template/twig/node/includecss.php
	phpBB/phpbb/template/twig/node/includejs.php
	phpBB/phpbb/template/twig/twig.php
	tests/controller/helper_url_test.php
	tests/di/create_container_test.php
	tests/extension/style_path_provider_test.php
	tests/notification/notification_test.php
	tests/session/continue_test.php
	tests/session/creation_test.php
	tests/template/template_events_test.php
	tests/template/template_test_case.php
	tests/template/template_test_case_with_tree.php
	tests/test_framework/phpbb_functional_test_case.php
This commit is contained in:
Nils Adermann
2013-09-16 01:24:05 +02:00
330 changed files with 10287 additions and 6367 deletions

View File

@@ -0,0 +1,63 @@
<?php
/**
*
* @package testing
* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
require_once dirname(__FILE__) . '/common_avatar_test.php';
/**
* @group functional
*/
class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_avatar_test
{
public function get_url()
{
return 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5';
}
public function avatar_acp_groups_data()
{
return array(
// Correct Gravatar
array(
'GROUP_UPDATED',
'avatar_driver_gravatar',
array(
'avatar_gravatar_email' => 'test@example.com',
'avatar_gravatar_width' => 80,
'avatar_gravatar_height' => 80,
),
),
// Gravatar with incorrect size
array(
'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.',
'avatar_driver_gravatar',
array(
'avatar_gravatar_email' => 'test@example.com',
'avatar_gravatar_width' => 120,
'avatar_gravatar_height' => 120,
),
),
// Delete avatar image to reset group settings
array(
'GROUP_UPDATED',
'avatar_driver_gravatar',
array(
'avatar_delete' => array('tick', ''),
),
),
);
}
/**
* @dataProvider avatar_acp_groups_data
*/
public function test_avatar_acp_groups($expected, $avatar_type, $data)
{
$this->assert_avatar_submit($expected, $avatar_type, $data);
}
}

View File

@@ -0,0 +1,61 @@
<?php
/**
*
* @package testing
* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
require_once dirname(__FILE__) . '/common_avatar_test.php';
/**
* @group functional
*/
class phpbb_functional_avatar_acp_users_test extends phpbb_functional_common_avatar_test
{
public function get_url()
{
return 'adm/index.php?i=acp_users&u=2&mode=avatar';
}
public function avatar_acp_users_data()
{
return array(
// Gravatar with incorrect email
array(
'EMAIL_INVALID_EMAIL',
'avatar_driver_gravatar',
array(
'avatar_gravatar_email' => 'test.example.com',
'avatar_gravatar_width' => 80,
'avatar_gravatar_height' => 80,
),
),
// Remote avatar with correct link
array(
'USER_AVATAR_UPDATED',
'avatar_driver_upload',
array(
'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
),
),
// Reset avatar settings
array(
'USER_AVATAR_UPDATED',
'avatar_driver_gravatar',
array(
'avatar_delete' => array('tick', ''),
),
),
);
}
/**
* @dataProvider avatar_acp_users_data
*/
public function test_avatar_acp_users($expected, $avatar_type, $data)
{
$this->assert_avatar_submit($expected, $avatar_type, $data);
}
}

View File

@@ -0,0 +1,71 @@
<?php
/**
*
* @package testing
* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
require_once dirname(__FILE__) . '/common_avatar_test.php';
/**
* @group functional
*/
class phpbb_functional_avatar_ucp_groups_test extends phpbb_functional_common_avatar_test
{
public function get_url()
{
return 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5';
}
public function avatar_ucp_groups_data()
{
return array(
// Incorrect URL
array(
'AVATAR_URL_INVALID',
'avatar_driver_upload',
array(
'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=80',
),
),
/*
// Does not work due to DomCrawler issue
// Valid file upload
array(
'GROUP_UPDATED',
'avatar_driver_upload',
array(
'avatar_upload_file' => array('upload', $this->path . 'valid.jpg'),
),
),
*/
// Correct remote avatar
array(
'GROUP_UPDATED',
'avatar_driver_remote',
array(
'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
'avatar_remote_width' => 80,
'avatar_remote_height' => 80,
),
),
array(
'GROUP_UPDATED',
'avatar_driver_gravatar',
array(
'avatar_delete' => array('tick', ''),
),
),
);
}
/**
* @dataProvider avatar_ucp_groups_data
*/
public function test_avatar_ucp_groups($expected, $avatar_type, $data)
{
$this->assert_avatar_submit($expected, $avatar_type, $data);
}
}

View File

@@ -0,0 +1,78 @@
<?php
/**
*
* @package testing
* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
require_once dirname(__FILE__) . '/common_avatar_test.php';
/**
* @group functional
*/
class phpbb_functional_avatar_ucp_users_test extends phpbb_functional_common_avatar_test
{
public function get_url()
{
return 'ucp.php?i=ucp_profile&mode=avatar';
}
public function avatar_ucp_groups_data()
{
return array(
// Gravatar with correct settings
array(
'PROFILE_UPDATED',
'avatar_driver_gravatar',
array(
'avatar_gravatar_email' => 'test@example.com',
'avatar_gravatar_width' => 80,
'avatar_gravatar_height' => 80,
),
),
// Wrong driver selected
array(
'NO_AVATAR_SELECTED',
'avatar_driver_upload',
array(
'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
'avatar_remote_width' => 80,
'avatar_remote_height' => 80,
),
),
array(
'PROFILE_UPDATED',
'avatar_driver_gravatar',
array(
'avatar_delete' => array('tick', ''),
),
),
);
}
/**
* @dataProvider avatar_ucp_groups_data
*/
public function test_avatar_ucp_groups($expected, $avatar_type, $data)
{
$this->assert_avatar_submit($expected, $avatar_type, $data);
}
public function test_display_upload_avatar()
{
$this->assert_avatar_submit('PROFILE_UPDATED',
'avatar_driver_upload',
array(
'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
)
);
$crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid);
$avatar_link = $crawler->filter('img')->attr('src');
$crawler = self::request('GET', $avatar_link . '&sid=' . $this->sid, array(), false);
$content = self::$client->getResponse()->getContent();
self::assertEquals(false, stripos(trim($content), 'debug'), 'Output contains debug message');
}
}

View File

@@ -29,4 +29,11 @@ class phpbb_functional_browse_test extends phpbb_functional_test_case
$crawler = self::request('GET', 'viewtopic.php?t=1');
$this->assertGreaterThan(0, $crawler->filter('.postbody')->count());
}
public function test_feed()
{
$crawler = self::request('GET', 'feed.php', array(), false);
self::assert_response_xml();
$this->assertGreaterThan(0, $crawler->filter('entry')->count());
}
}

View File

@@ -0,0 +1,80 @@
<?php
/**
*
* @package testing
* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @group functional
*/
abstract class phpbb_functional_common_avatar_test extends phpbb_functional_test_case
{
private $path;
private $form_content;
abstract function get_url();
public function setUp()
{
parent::setUp();
$this->path = __DIR__ . '/fixtures/files/';
$this->login();
$this->admin_login();
$this->add_lang(array('acp/board', 'ucp', 'acp/users', 'acp/groups'));
$this->set_acp_settings();
}
private function set_acp_settings()
{
$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_AVATARS', $crawler->text());
$this->assertContainsLang('ALLOW_LOCAL', $crawler->text());
// Now start setting the needed settings
$form = $crawler->selectButton($this->lang('SUBMIT'))->form();
$form['config[allow_avatar_local]']->select(1);
$form['config[allow_avatar_gravatar]']->select(1);
$form['config[allow_avatar_remote]']->select(1);
$form['config[allow_avatar_remote_upload]']->select(1);
$crawler = self::submit($form);
$this->assertContainsLang('CONFIG_UPDATED', $crawler->text());
}
public function assert_avatar_submit($expected, $type, $data, $button_text = 'SUBMIT')
{
$crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid);
// Test if setting a gravatar avatar properly works
$form = $crawler->selectButton($this->lang($button_text))->form();
$form['avatar_driver']->select($type);
foreach ($data as $key => $value)
{
if (is_array($value))
{
$form[$key]->$value[0]($value[1]);
}
else
{
$form[$key]->setValue($value);
}
}
$crawler = self::submit($form);
try
{
$this->assertContainsLang($expected, $crawler->text());
}
catch (Exception $e)
{
$this->assertContains($expected, $crawler->text());
}
}
}

View File

@@ -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,7 +76,7 @@ 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->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());
}

View File

@@ -0,0 +1,63 @@
<?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_extension_global_lang_test extends phpbb_functional_test_case
{
protected $phpbb_extension_manager;
static private $helper;
static protected $fixtures = array(
'foo/bar/language/en/',
'foo/bar/event/',
);
static public function setUpBeforeClass()
{
parent::setUpBeforeClass();
self::$helper = new phpbb_test_case_helpers(self);
self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures);
}
static public function tearDownAfterClass()
{
parent::tearDownAfterClass();
self::$helper->restore_original_ext_dir();
}
public function setUp()
{
parent::setUp();
$this->get_db();
$this->phpbb_extension_manager = $this->get_extension_manager();
$this->purge_cache();
}
public function test_load_extension_lang_globally()
{
$this->phpbb_extension_manager->enable('foo/bar');
// The board index, which should contain an overwritten translation
$crawler = self::request('GET', 'index.php');
// language from language/en/common.php
$this->assertNotContains('Skip to content', $crawler->filter('.skiplink')->text());
// language from ext/foo/bar/language/en/foo_global.php
$this->assertContains('Overwritten by foo', $crawler->filter('.skiplink')->text());
}
}

View File

@@ -18,6 +18,7 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t
static protected $fixtures = array(
'foo/bar/language/en/',
'foo/bar/event/',
);
static public function setUpBeforeClass()
@@ -75,6 +76,6 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t
$this->assertContains('Can attach files', $crawler->filter('body')->text());
// language from ext/foo/bar/language/en/permissions_foo.php
$this->assertContains('Can view foo', $crawler->filter('body')->text());
$this->assertContains('Can view foobar', $crawler->filter('body')->text());
}
}

View File

@@ -44,14 +44,14 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
public function test_invalid_extension()
{
$upload = new fileupload('', array('jpg'), 100);
$file = $upload->remote_upload('http://example.com/image.gif');
$file = $upload->remote_upload(self::$root_url . 'develop/blank.gif');
$this->assertEquals('URL_INVALID', $file->error[0]);
}
public function test_non_existant()
public function test_empty_file()
{
$upload = new fileupload('', array('jpg'), 100);
$file = $upload->remote_upload('http://example.com/image.jpg');
$file = $upload->remote_upload(self::$root_url . 'develop/blank.jpg');
$this->assertEquals('EMPTY_REMOTE_DATA', $file->error[0]);
}

View File

@@ -0,0 +1,40 @@
<?php
/**
*
* @package testing
* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Event listener
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class phpbb_ext_foo_bar_event_permission implements EventSubscriberInterface
{
static public function getSubscribedEvents()
{
return array(
'core.permissions' => 'add_permissions',
);
}
public function add_permissions($event)
{
$permissions = $event['permissions'];
$permissions['u_foo'] = array('lang' => 'ACL_U_FOOBAR', 'cat' => 'post');
$event['permissions'] = $permissions;
}
}

View File

@@ -0,0 +1,43 @@
<?php
/**
*
* @package testing
* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Event listener
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class phpbb_ext_foo_bar_event_user_setup implements EventSubscriberInterface
{
static public function getSubscribedEvents()
{
return array(
'core.user_setup' => 'add_global_translations',
);
}
public function add_global_translations($event)
{
$lang_set_ext = $event['lang_set_ext'];
$lang_set_ext[] = array(
'ext_name' => 'foo/bar',
'lang_set' => 'foo_global',
);
$event['lang_set_ext'] = $lang_set_ext;
}
}

View File

@@ -0,0 +1,5 @@
<?php
$lang = array_merge($lang, array(
'SKIP' => 'Overwritten by foo',
));

View File

@@ -1,6 +1,5 @@
<?php
// Admin Permissions
$lang = array_merge($lang, array(
'acl_u_foo' => array('lang' => 'Can view foo', 'cat' => 'misc'),
'ACL_U_FOOBAR' => 'Can view foobar with permission foo',
));

View File

@@ -0,0 +1,67 @@
<?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_mcp_test extends phpbb_functional_test_case
{
public function test_post_new_topic()
{
$this->login();
// Test creating topic
$post = $this->create_topic(2, 'Test Topic 2', 'Testing move post with "Move posts" option from Quick-Moderator Tools.');
$crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}");
$this->assertContains('Testing move post with "Move posts" option from Quick-Moderator Tools.', $crawler->filter('html')->text());
return $crawler;
}
/**
* @depends test_post_new_topic
*/
public function test_handle_quickmod($crawler)
{
// Test moving a post
$form = $crawler->selectButton('Go')->eq(1)->form();
$form['action']->select('merge');
$crawler = self::submit($form);
return $crawler;
}
/**
* @depends test_handle_quickmod
*/
public function test_move_post_to_topic($crawler)
{
// Select the post in MCP
$form = $crawler->selectButton($this->lang('SUBMIT'))->form(array(
'to_topic_id' => 1,
));
$form['post_id_list'][0]->tick();
$crawler = self::submit($form);
$this->assertContains($this->lang('MERGE_POSTS'), $crawler->filter('html')->text());
return $crawler;
}
/**
* @depends test_move_post_to_topic
*/
public function test_confirm_result($crawler)
{
$this->add_lang('mcp');
$form = $crawler->selectButton('Yes')->form();
$crawler = self::submit($form);
$this->assertContains($this->lang('POSTS_MERGED_SUCCESS'), $crawler->text());
}
}

View File

@@ -12,13 +12,6 @@
*/
class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_case
{
public function test_user_report_post()
{
$this->login();
$crawler = self::request('GET', 'report.php?f=2&p=1');
$this->assertNotContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text());
}
public function test_guest_report_post()
{
$crawler = self::request('GET', 'report.php?f=2&p=1');
@@ -31,6 +24,18 @@ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_ca
$this->set_reporting_guest(-1);
}
public function test_user_report_post()
{
$this->login();
$crawler = self::request('GET', 'report.php?f=2&p=1');
$this->assertNotContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text());
$this->add_lang('mcp');
$form = $crawler->selectButton($this->lang('SUBMIT'))->form();
$crawler = self::submit($form);
$this->assertContains($this->lang('POST_REPORTED_SUCCESS'), $crawler->text());
}
protected function set_reporting_guest($report_post_allowed)
{
$this->login();