1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-21 16:01:40 +02:00

Merge branch 'develop' of github.com:phpbb/phpbb3 into ticket/11628

# By Bruno Ais (42) and others
# Via Joas Schilling (39) and others
* 'develop' of github.com:phpbb/phpbb3: (157 commits)
  [ticket/11803] Revert POLL_MAX_OPTIONS min value to 0
  [ticket/11799] Send anti abuse headers in "new password" emails.
  [ticket/11792] Add functional test for var lang_set_ext of core.user_setup
  [ticket/11804] Remove </li> from overall_header which was not open
  [ticket/11802] replace $browser with $user->browser
  [ticket/11801] removed some whitespace and added missing semi colon's in css
  [ticket/11792] Add performance remark to core.user_setup event PHPDoc
  [ticket/11792] Add variable 'lang_set_ext' to event core.user_setup
  [ticket/11789] Remove inline color in memberlist_view
  [ticket/11800] Fix scripts variable in subsilver simple_footer
  [ticket/11800] Fix JavaScript in simple_footer.html
  [ticket/11800] Remove forum_fn from memberlist_search.html
  [ticket/11796] Replace pagination with pagination.html
  [ticket/11794] Add missing array element commas to docs/coding-guidelines.html
  [ticket/11775] Fix doc blocks syntax
  [ticket/11775] Remove spaces at line ends
  [ticket/11789] Remove colors from HTML code
  [ticket/11784] Remove naming redundancy for event listeners
  [ticket/11775] Split test into multiple steps
  [ticket/11777] Fix new test for loop variables in extension template listeners
  ...

Conflicts:
	phpBB/install/index.php
	phpBB/install/install_update.php
This commit is contained in:
Nathan Guse
2013-08-28 13:30:48 -05:00
152 changed files with 1038 additions and 648 deletions

View File

@@ -17,7 +17,7 @@ class phpbb_di_container_test extends phpbb_test_case
$phpbb_root_path = __DIR__ . '/../../phpBB/';
$extensions = array(
new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'),
new phpbb_di_extension_core($phpbb_root_path),
new phpbb_di_extension_core($phpbb_root_path . 'config'),
);
$container = phpbb_create_container($extensions, $phpbb_root_path, 'php');
@@ -29,7 +29,7 @@ class phpbb_di_container_test extends phpbb_test_case
$phpbb_root_path = __DIR__ . '/../../phpBB/';
$extensions = array(
new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'),
new phpbb_di_extension_core($phpbb_root_path),
new phpbb_di_extension_core($phpbb_root_path . 'config'),
);
$container = phpbb_create_install_container($phpbb_root_path, 'php');
@@ -43,7 +43,7 @@ class phpbb_di_container_test extends phpbb_test_case
$config_file = __DIR__ . '/fixtures/config.php';
$extensions = array(
new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'),
new phpbb_di_extension_core($phpbb_root_path),
new phpbb_di_extension_core($phpbb_root_path . 'config'),
);
$container = phpbb_create_compiled_container($config_file, $extensions, array(), $phpbb_root_path, 'php');

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

@@ -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

@@ -22,7 +22,7 @@ if (!defined('IN_PHPBB'))
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class phpbb_ext_foo_bar_event_permission_listener implements EventSubscriberInterface
class phpbb_ext_foo_bar_event_permission implements EventSubscriberInterface
{
static public function getSubscribedEvents()
{

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

@@ -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

@@ -0,0 +1 @@
{event_loop.S_ROW_COUNT}<!-- IF not event_loop.S_LAST_ROW -->|<!-- ENDIF -->

View File

@@ -0,0 +1,3 @@
<!-- BEGIN event_loop -->
event_loop<!-- EVENT test_event_loop -->
<!-- END event_loop -->

View File

@@ -80,6 +80,16 @@ Zeta test event in all',
array(),
'two in silver in omega',
),
array(
'EVENT in loop',
'ext_trivial',
array('silver'),
'event_loop.html',
array(),
array('event_loop' => array(array(), array(), array())),
array(),
'event_loop0|event_loop1|event_loop2',
),
);
}

View File

@@ -93,49 +93,49 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(
'loop.html',
array(),
array('loop' => array(array())),
array('test_loop' => array(array())),
array(),
"loop\nloop",
),
array(
'loop.html',
array(),
array('loop' => array(array(), array()), 'loop.block' => array(array())),
array('test_loop' => array(array(), array()), 'test_loop.block' => array(array())),
array(),
"loop\nloop\nloop\nloop",
),
array(
'loop.html',
array(),
array('loop' => array(array(), array()), 'loop.block' => array(array()), 'block' => array(array(), array())),
array('test_loop' => array(array(), array()), 'test_loop.block' => array(array()), 'block' => array(array(), array())),
array(),
"loop\nloop\nloop\nloop\nloop#0-block#0\nloop#0-block#1\nloop#1-block#0\nloop#1-block#1",
),
array(
'loop_vars.html',
array(),
array('loop' => array(array('VARIABLE' => 'x'))),
array('test_loop' => array(array('VARIABLE' => 'x'))),
array(),
"first\n0 - a\nx - b\nset\nlast",
),
array(
'loop_vars.html',
array(),
array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y'))),
array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y'))),
array(),
"first\n0 - a\nx - b\nset\n1 - a\ny - b\nset\nlast",
),
array(
'loop_vars.html',
array(),
array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())),
array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'test_loop.inner' => array(array(), array())),
array(),
"first\n0 - a\nx - b\nset\n1 - a\ny - b\nset\nlast\n0 - c\n1 - c\nlast inner",
),
array(
'loop_advanced.html',
array(),
array('loop' => array(array(), array(), array(), array(), array(), array(), array())),
array('test_loop' => array(array(), array(), array(), array(), array(), array(), array())),
array(),
"101234561\nx\n101234561\nx\n101234561\nx\n1234561\nx\n1\nx\n101\nx\n234\nx\n10\nx\n561\nx\n561",
),
@@ -149,14 +149,14 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(
'define.html',
array(),
array('loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())),
array('test_loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())),
array(),
"xyz\nabc\n\$VALUE == 'abc'abc\nbar\nbar\nabc\ntest!@#$%^&*()_-=+{}[]:;\",<.>/?",
),
array(
'define_advanced.html',
array(),
array('loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())),
array('test_loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())),
array(),
"abc\nzxc\ncde\nbcd",
),
@@ -200,7 +200,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(
'include_loop.html',
array(),
array('loop' => array(array('NESTED_FILE' => 'include_loop1.html')), 'loop.inner' => array(array('NESTED_FILE' => 'include_loop1.html'), array('NESTED_FILE' => 'include_loop2.html'), array('NESTED_FILE' => 'include_loop3.html'))),
array('test_loop' => array(array('NESTED_FILE' => 'include_loop1.html')), 'test_loop.inner' => array(array('NESTED_FILE' => 'include_loop1.html'), array('NESTED_FILE' => 'include_loop2.html'), array('NESTED_FILE' => 'include_loop3.html'))),
array(),
"1\n_1\n_02\n_3",
),
@@ -221,8 +221,8 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(
'loop_vars.html',
array(),
array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())),
array('loop'),
array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'test_loop.inner' => array(array(), array())),
array('test_loop'),
'',
),
array(
@@ -235,7 +235,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(
'include_loop_define.html',
array('VARIABLE' => 'value'),
array('loop' => array(array('NESTED_FILE' => 'variable.html'))),
array('test_loop' => array(array('NESTED_FILE' => 'variable.html'))),
array(),
'value',
),
@@ -243,8 +243,8 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(
'loop_vars.html',
array(),
array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())),
array('loop.inner'),
array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'test_loop.inner' => array(array(), array())),
array('test_loop.inner'),
"first\n0\n0\n2\nx\nset\n1\n1\n2\ny\nset\nlast",
),*/
array(
@@ -295,7 +295,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(
'loop_size.html',
array(),
array('loop' => array(array()), 'empty_loop' => array()),
array('test_loop' => array(array()), 'empty_loop' => array()),
array(),
"nonexistent = 0\n! nonexistent\n\nempty = 0\n! empty\nloop\n\nin loop",
),

View File

@@ -1,4 +1,4 @@
<!-- BEGIN loop -->
<!-- INCLUDE {loop.NESTED_FILE} -->
<!-- BEGIN inner -->_<!-- INCLUDE {inner.NESTED_FILE} --><!-- END inner -->
<!-- END loop -->
<!-- BEGIN test_loop -->
<!-- INCLUDE {test_loop.NESTED_FILE} -->
<!-- BEGIN inner -->_<!-- INCLUDE {test_loop.inner.NESTED_FILE} --><!-- END inner -->
<!-- END test_loop -->

View File

@@ -1,4 +1,4 @@
<!-- BEGIN loop -->
<!-- DEFINE $DEF = '{loop.NESTED_FILE}' -->
<!-- BEGIN test_loop -->
<!-- DEFINE $DEF = '{test_loop.NESTED_FILE}' -->
<!-- INCLUDE {$DEF} -->
<!-- END loop -->
<!-- END test_loop -->

View File

@@ -1,21 +1,21 @@
<!-- BEGIN loop -->
<!-- BEGIN test_loop -->
loop
<!-- BEGINELSE -->
noloop
<!-- END loop -->
<!-- END test_loop -->
<!-- IF .loop -->
<!-- IF .test_loop -->
loop
<!-- ELSE -->
noloop
<!-- ENDIF -->
<!-- IF .loop == 2 -->
<!-- IF .test_loop == 2 -->
loop
<!-- ENDIF -->
<!-- BEGIN loop -->
<!-- BEGIN test_loop -->
<!-- BEGIN !block -->
loop#{loop.S_ROW_COUNT}-block#{block.S_ROW_COUNT}
loop#{test_loop.S_ROW_COUNT}-block#{block.S_ROW_COUNT}
<!-- END !block -->
<!-- END loop -->
<!-- END test_loop -->

View File

@@ -1,19 +1,19 @@
<!-- BEGIN loop -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
<!-- BEGIN test_loop -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop -->
x
<!-- BEGIN loop(0) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
<!-- BEGIN test_loop(0) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop -->
x
<!-- BEGIN loop(0,-1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
<!-- BEGIN test_loop(0,-1) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop -->
x
<!-- BEGIN loop(1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
<!-- BEGIN test_loop(1) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop -->
x
<!-- BEGIN loop(1,1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
<!-- BEGIN test_loop(1,1) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop -->
x
<!-- BEGIN loop(0,1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
<!-- BEGIN test_loop(0,1) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop -->
x
<!-- BEGIN loop(2,4) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
<!-- BEGIN test_loop(2,4) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop -->
x
<!-- BEGIN loop(0,-7) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
<!-- BEGIN test_loop(0,-7) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop -->
x
<!-- BEGIN loop(-2,6) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
<!-- BEGIN test_loop(-2,6) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop -->
x
<!-- BEGIN loop(-2,-1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
<!-- BEGIN test_loop(-2,-1) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop -->

View File

@@ -22,18 +22,18 @@
! empty
<!-- ENDIF -->
<!-- IF .loop -->
<!-- IF .test_loop -->
loop
<!-- ENDIF -->
<!-- IF .loop == 0 -->
<!-- IF .test_loop == 0 -->
loop = 0
<!-- ENDIF -->
<!-- IF ! .loop -->
<!-- IF ! .test_loop -->
! loop
<!-- ENDIF -->
<!-- BEGIN loop -->
<!-- BEGIN test_loop -->
in loop
<!-- END loop -->
<!-- END test_loop -->

View File

@@ -1,13 +1,13 @@
<!-- BEGIN loop -->
<!-- IF loop.S_FIRST_ROW -->first<!-- ENDIF -->
{loop.S_ROW_NUM} - a
{loop.VARIABLE} - b
<!-- IF loop.VARIABLE -->set<!-- ENDIF -->
<!-- IF loop.S_LAST_ROW -->
<!-- BEGIN test_loop -->
<!-- IF test_loop.S_FIRST_ROW -->first<!-- ENDIF -->
{test_loop.S_ROW_NUM} - a
{test_loop.VARIABLE} - b
<!-- IF test_loop.VARIABLE -->set<!-- ENDIF -->
<!-- IF test_loop.S_LAST_ROW -->
last
<!-- ENDIF -->
<!-- BEGIN inner -->
{inner.S_ROW_NUM} - c
<!-- IF inner.S_LAST_ROW and inner.S_ROW_COUNT and inner.S_NUM_ROWS -->last inner<!-- ENDIF -->
{test_loop.inner.S_ROW_NUM} - c
<!-- IF test_loop.inner.S_LAST_ROW and test_loop.inner.S_ROW_COUNT and test_loop.inner.S_NUM_ROWS -->last inner<!-- ENDIF -->
<!-- END inner -->
<!-- END loop -->
<!-- END test_loop -->

View File

@@ -957,7 +957,7 @@ class phpbb_functional_test_case extends phpbb_test_case
);
}
/*
/**
* Returns the requested parameter from a URL
*
* @param string $url

View File

@@ -0,0 +1,38 @@
<?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__) . '/../../phpBB/includes/functions.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
require_once dirname(__FILE__) . '/../mock/user.php';
require_once dirname(__FILE__) . '/../mock/cache.php';
class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_case
{
public function setUp()
{
global $cache, $user;
parent::setUp();
$cache = new phpbb_mock_cache;
$user = new phpbb_mock_user;
$user->optionset('viewcensors', false);
}
public function test_empty_string()
{
$this->assertSame('', generate_text_for_display('', '', '', 0));
}
public function test_zero_string()
{
$this->assertSame('0', generate_text_for_display('0', '', '', 0));
}
}