mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
Merge remote-tracking branch 'github-prototech/ticket/11508' into develop-ascraeus
* github-prototech/ticket/11508: [ticket/11508] Fix build_url test. [ticket/11508] Add functional test for jumpbox. [ticket/11508] Use $phpbb_path_helper. [ticket/11508] Allow equal sign in parameter value. [ticket/11508] Remove unnecessary implode. [ticket/11508] Remove unnecessary isset check. [ticket/11508] Fix build_url test. [ticket/11508] Curly brace should be on its own line... [ticket/11508] The question mark is expected even if there are no parameters. [ticket/11508] Add tests. [ticket/11508] Do not add the '?' unless there are parameters. [ticket/11508] Change separator parameter to a simple true|false $is_amp. [ticket/11508] Move helper functions to path_helper class. [ticket/11508] Move the stripping param code to separate function as well. [ticket/11508] Build the jumpbox hidden fields using the _form action_ [ticket/11508] Split parts of build_url() into reusable functions.
This commit is contained in:
77
tests/functions/build_url_test.php
Normal file
77
tests/functions/build_url_test.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2014 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_build_url_test extends phpbb_test_case
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
global $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpbb_path_helper;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$phpbb_container = new phpbb_mock_container_builder();
|
||||
$user = new phpbb_mock_user();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
|
||||
$phpbb_path_helper = new \phpbb\path_helper(
|
||||
new \phpbb\symfony_request(
|
||||
new phpbb_mock_request()
|
||||
),
|
||||
new \phpbb\filesystem(),
|
||||
$phpbb_root_path,
|
||||
'php'
|
||||
);
|
||||
$phpbb_container->set('path_helper', $path_helper);
|
||||
}
|
||||
public function build_url_test_data()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'index.php',
|
||||
false,
|
||||
'phpBB/index.php?',
|
||||
),
|
||||
array(
|
||||
'index.php',
|
||||
't',
|
||||
'phpBB/index.php?',
|
||||
),
|
||||
array(
|
||||
'viewtopic.php?f=2&style=1&t=6',
|
||||
'f',
|
||||
'phpBB/viewtopic.php?style=1&t=6',
|
||||
),
|
||||
array(
|
||||
'viewtopic.php?f=2&style=1&t=6',
|
||||
array('f', 'style', 't'),
|
||||
'phpBB/viewtopic.php?',
|
||||
),
|
||||
array(
|
||||
'http://test.phpbb.com/viewtopic.php?f=2&style=1&t=6',
|
||||
array('f', 'style', 't'),
|
||||
'http://test.phpbb.com/viewtopic.php?',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider build_url_test_data
|
||||
*/
|
||||
public function test_build_url($page, $strip_vars, $expected)
|
||||
{
|
||||
global $user, $phpbb_root_path;
|
||||
|
||||
$user->page['page'] = $page;
|
||||
$output = build_url($strip_vars);
|
||||
|
||||
$this->assertEquals($expected, $output);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user