diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2011-08-21 13:14:15 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2011-08-21 13:16:05 +0200 |
commit | dc149a43e49c1c2160549e25792c5ee650861e02 (patch) | |
tree | 05b2f814a1202b3d145863393ed2cf6a3f5c0d5d /tests/session | |
parent | 1680b3a2a7614fb35d9119652140db2ff8bf5b0e (diff) | |
download | forums-dc149a43e49c1c2160549e25792c5ee650861e02.tar forums-dc149a43e49c1c2160549e25792c5ee650861e02.tar.gz forums-dc149a43e49c1c2160549e25792c5ee650861e02.tar.bz2 forums-dc149a43e49c1c2160549e25792c5ee650861e02.tar.xz forums-dc149a43e49c1c2160549e25792c5ee650861e02.zip |
[ticket/10321] Do not append the ? if the param-list is empty anyway.
PHPBB3-10321
Diffstat (limited to 'tests/session')
-rw-r--r-- | tests/session/append_sid_test.php | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/session/append_sid_test.php b/tests/session/append_sid_test.php new file mode 100644 index 0000000000..4a95b2d20e --- /dev/null +++ b/tests/session/append_sid_test.php @@ -0,0 +1,51 @@ +<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+
+class phpbb_session_append_sid_test extends phpbb_test_case
+{
+
+ public function append_sid_data()
+ {
+ return array(
+ array('viewtopic.php?t=1&f=2', false, true, false, 'viewtopic.php?t=1&f=2'),
+ array('viewtopic.php', 't=1&f=2', true, false, 'viewtopic.php?t=1&f=2'),
+ array('viewtopic.php', 't=1&f=2', false, false, 'viewtopic.php?t=1&f=2'),
+ array('viewtopic.php', array('t' => 1, 'f' => 2), true, false, 'viewtopic.php?t=1&f=2'),
+
+ // Custom sid parameter
+ array('viewtopic.php', 't=1&f=2', true, 'custom-sid', 'viewtopic.php?t=1&f=2&sid=custom-sid'),
+
+ // Testing anchors
+ array('viewtopic.php?t=1&f=2#anchor', false, true, false, 'viewtopic.php?t=1&f=2#anchor'),
+ array('viewtopic.php', 't=1&f=2#anchor', true, false, 'viewtopic.php?t=1&f=2#anchor'),
+ array('viewtopic.php', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'viewtopic.php?t=1&f=2#anchor'),
+
+ // Anchors and custom sid
+ array('viewtopic.php?t=1&f=2#anchor', false, true, 'custom-sid', 'viewtopic.php?t=1&f=2&sid=custom-sid#anchor'),
+ array('viewtopic.php', 't=1&f=2#anchor', true, 'custom-sid', 'viewtopic.php?t=1&f=2&sid=custom-sid#anchor'),
+ array('viewtopic.php', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'viewtopic.php?t=1&f=2&sid=custom-sid#anchor'),
+
+ // Empty parameters should not append the ?
+ array('viewtopic.php', false, true, false, 'viewtopic.php'),
+ array('viewtopic.php', '', true, false, 'viewtopic.php'),
+ array('viewtopic.php', array(), true, false, 'viewtopic.php'),
+ );
+ }
+
+ /**
+ * @dataProvider append_sid_data
+ */
+ public function test_append_sid($url, $params, $is_amp, $session_id, $expected)
+ {
+ $this->assertEquals($expected, append_sid($url, $params, $is_amp, $session_id));
+ }
+}
+
|