aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoshyPHP <s9e.dev@gmail.com>2015-12-05 19:48:01 +0100
committerJoshyPHP <s9e.dev@gmail.com>2015-12-26 14:19:22 +0100
commit8fe94a19b46c4e33a117c1a040415f2b1c397e7c (patch)
tree97a3279742d78a2cc30cfbf1dfc4d889c7b190d5 /tests
parenteb6ceb963ea7b32ef852b53d3da3a7e795291359 (diff)
downloadforums-8fe94a19b46c4e33a117c1a040415f2b1c397e7c.tar
forums-8fe94a19b46c4e33a117c1a040415f2b1c397e7c.tar.gz
forums-8fe94a19b46c4e33a117c1a040415f2b1c397e7c.tar.bz2
forums-8fe94a19b46c4e33a117c1a040415f2b1c397e7c.tar.xz
forums-8fe94a19b46c4e33a117c1a040415f2b1c397e7c.zip
[ticket/14323] Added support for truncating local URLs
PHPBB3-14323
Diffstat (limited to 'tests')
-rw-r--r--tests/test_framework/phpbb_test_case_helpers.php9
-rw-r--r--tests/text_formatter/s9e/default_formatting_test.php8
-rw-r--r--tests/text_processing/tickets_data/PHPBB3-10587.html4
-rw-r--r--tests/text_processing/tickets_data/PHPBB3-10587.txt4
4 files changed, 20 insertions, 5 deletions
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php
index 0166b11d06..cb77c6829c 100644
--- a/tests/test_framework/phpbb_test_case_helpers.php
+++ b/tests/test_framework/phpbb_test_case_helpers.php
@@ -315,7 +315,7 @@ class phpbb_test_case_helpers
public function set_s9e_services(ContainerInterface $container = null, $fixture = null, $styles_path = null)
{
static $first_run;
- global $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx, $user;
+ global $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx, $request, $user;
$cache_dir = __DIR__ . '/../tmp/';
@@ -490,6 +490,12 @@ class phpbb_test_case_helpers
}
}
+ // Create a fake request
+ if (!isset($request))
+ {
+ $request = new phpbb_mock_request;
+ }
+
// Create and register the text_formatter.s9e.factory service
$factory = new \phpbb\textformatter\s9e\factory($dal, $cache, $dispatcher, $config, $cache_dir, $cache_key_parser, $cache_key_renderer);
$container->set('text_formatter.s9e.factory', $factory);
@@ -513,6 +519,7 @@ class phpbb_test_case_helpers
->will($this->test_case->returnCallback(__CLASS__ . '::format_date'));
$user->date_format = 'Y-m-d H:i:s';
+ $user->host = 'localhost';
$user->optionset('viewcensors', true);
$user->optionset('viewflash', true);
$user->optionset('viewimg', true);
diff --git a/tests/text_formatter/s9e/default_formatting_test.php b/tests/text_formatter/s9e/default_formatting_test.php
index facffd5df1..b5777a42d4 100644
--- a/tests/text_formatter/s9e/default_formatting_test.php
+++ b/tests/text_formatter/s9e/default_formatting_test.php
@@ -236,6 +236,14 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case
'<a href="http://www.phpbb.com/community/path/to/long/url/file.ext#section" class="postlink">http://www.phpbb.com/community/path/to/ ... xt#section</a>'
),
array(
+ 'http://localhost/ http://localhost/viewforum.php?f=1',
+ '<a href="http://localhost/" class="postlink">http://localhost/</a> <a href="http://localhost/viewforum.php?f=1" class="postlink">viewforum.php?f=1</a>'
+ ),
+ array(
+ 'http://localhost/viewforum.php?f=1#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
+ '<a href="http://localhost/viewforum.php?f=1#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" class="postlink">viewforum.php?f=1#xxxxxxxxxxxxxxxxxxxxx ... xxxxxxxxxx</a>'
+ ),
+ array(
'[quote="[url=http://example.org]xxx[/url]"]...[/quote]',
'<blockquote><div><cite><a href="http://example.org" class="postlink">xxx</a> wrote:</cite>...</div></blockquote>'
),
diff --git a/tests/text_processing/tickets_data/PHPBB3-10587.html b/tests/text_processing/tickets_data/PHPBB3-10587.html
index dd0a483244..4c2e536989 100644
--- a/tests/text_processing/tickets_data/PHPBB3-10587.html
+++ b/tests/text_processing/tickets_data/PHPBB3-10587.html
@@ -1,2 +1,2 @@
-<a href="http://www.tx-gaming.net/warzone/tournament.php?tourney%5Bid%5D=34&amp;action=brackets" class="postlink">http://www.tx-gaming.net/warzone/tournament.php?tourney[id]=34&amp;action=brackets</a><br>
-<a href="http://www.tx-gaming.net/warzone/tournament.php?tourney%5Bid%5D=34&amp;action=brackets" class="postlink">link</a> \ No newline at end of file
+<a href="http://example.org/?tourney%5Bid%5D=34&amp;action=brackets" class="postlink">http://example.org/?tourney[id]=34&amp;action=brackets</a><br>
+<a href="http://example.org/?tourney%5Bid%5D=34&amp;action=brackets" class="postlink">link</a> \ No newline at end of file
diff --git a/tests/text_processing/tickets_data/PHPBB3-10587.txt b/tests/text_processing/tickets_data/PHPBB3-10587.txt
index f81a35eb5f..84788b720d 100644
--- a/tests/text_processing/tickets_data/PHPBB3-10587.txt
+++ b/tests/text_processing/tickets_data/PHPBB3-10587.txt
@@ -1,2 +1,2 @@
-[url]http://www.tx-gaming.net/warzone/tournament.php?tourney[id]=34&action=brackets[/url]
-[url="http://www.tx-gaming.net/warzone/tournament.php?tourney[id]=34&action=brackets"]link[/url] \ No newline at end of file
+[url]http://example.org/?tourney[id]=34&action=brackets[/url]
+[url="http://example.org/?tourney[id]=34&action=brackets"]link[/url] \ No newline at end of file