From b05382d226d2c5d68ff5a483d8885f65e754c90d Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Fri, 19 Aug 2011 00:13:34 +0200 Subject: [feature/request-class] Fix session_testable_factory PHPBB3-9716 --- tests/session/testable_factory.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tests/session') diff --git a/tests/session/testable_factory.php b/tests/session/testable_factory.php index 2b6a1683d3..3d4fbcc7cb 100644 --- a/tests/session/testable_factory.php +++ b/tests/session/testable_factory.php @@ -73,7 +73,8 @@ class phpbb_session_testable_factory $request = $this->request = new phpbb_mock_request( array(), array(), - $this->cookies + $this->cookies, + $this->server_data ); request_var(null, null, null, null, $request); @@ -85,8 +86,6 @@ class phpbb_session_testable_factory $cache = $this->cache = new phpbb_mock_cache($this->get_cache_data()); $SID = $_SID = null; - $_SERVER = $this->server_data; - $session = new phpbb_mock_session_testable; return $session; } -- cgit v1.2.1 From dc149a43e49c1c2160549e25792c5ee650861e02 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 21 Aug 2011 13:14:15 +0200 Subject: [ticket/10321] Do not append the ? if the param-list is empty anyway. PHPBB3-10321 --- tests/session/append_sid_test.php | 51 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/session/append_sid_test.php (limited to 'tests/session') 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 @@ + 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)); + } +} + -- cgit v1.2.1 From 5d66faafc159da90fbbc6d9888b0a6eee9570cd8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 21 Aug 2011 18:56:47 +0200 Subject: [ticket/10321] Add descriptions to the unit tests PHPBB3-10321 --- tests/session/append_sid_test.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'tests/session') diff --git a/tests/session/append_sid_test.php b/tests/session/append_sid_test.php index 4a95b2d20e..1a3ad633e3 100644 --- a/tests/session/append_sid_test.php +++ b/tests/session/append_sid_test.php @@ -15,35 +15,35 @@ 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'), + array('viewtopic.php?t=1&f=2', false, true, false, 'viewtopic.php?t=1&f=2', 'parameters in url-argument'), + array('viewtopic.php', 't=1&f=2', true, false, 'viewtopic.php?t=1&f=2', 'parameters in params-argument using amp'), + array('viewtopic.php', 't=1&f=2', false, false, 'viewtopic.php?t=1&f=2', 'parameters in params-argument using &'), + array('viewtopic.php', array('t' => 1, 'f' => 2), true, false, 'viewtopic.php?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('viewtopic.php', 't=1&f=2', true, 'custom-sid', 'viewtopic.php?t=1&f=2&sid=custom-sid'), + array('viewtopic.php', 't=1&f=2', true, 'custom-sid', 'viewtopic.php?t=1&f=2&sid=custom-sid', 'using session_id'), // 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'), + array('viewtopic.php?t=1&f=2#anchor', false, true, false, 'viewtopic.php?t=1&f=2#anchor', 'anchor in url-argument'), + array('viewtopic.php', 't=1&f=2#anchor', true, false, 'viewtopic.php?t=1&f=2#anchor', 'anchor in params-argument'), + array('viewtopic.php', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'viewtopic.php?t=1&f=2#anchor', 'anchor in params-argument (array)'), // 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'), + array('viewtopic.php?t=1&f=2#anchor', false, true, 'custom-sid', 'viewtopic.php?t=1&f=2&sid=custom-sid#anchor', 'anchor in url-argument using session_id'), + array('viewtopic.php', 't=1&f=2#anchor', true, 'custom-sid', 'viewtopic.php?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument using session_id'), + array('viewtopic.php', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'viewtopic.php?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // 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'), + array('viewtopic.php', false, true, false, 'viewtopic.php', 'no params using bool false'), + array('viewtopic.php', '', true, false, 'viewtopic.php', 'no params using empty string'), + array('viewtopic.php', array(), true, false, 'viewtopic.php', 'no params using empty array'), ); } /** * @dataProvider append_sid_data */ - public function test_append_sid($url, $params, $is_amp, $session_id, $expected) + public function test_append_sid($url, $params, $is_amp, $session_id, $expected, $description) { $this->assertEquals($expected, append_sid($url, $params, $is_amp, $session_id)); } -- cgit v1.2.1 From aef3652d7a11c956f0a16b3773fb59abc7b6d280 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 21 Nov 2011 13:09:27 +0100 Subject: [ticket/10483] Fix test suite when running with MySQL strict mode PHPBB3-10483 --- tests/session/fixtures/sessions_empty.xml | 16 ++++++++++++++++ tests/session/fixtures/sessions_full.xml | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'tests/session') diff --git a/tests/session/fixtures/sessions_empty.xml b/tests/session/fixtures/sessions_empty.xml index f94337314e..0e6ddccd88 100644 --- a/tests/session/fixtures/sessions_empty.xml +++ b/tests/session/fixtures/sessions_empty.xml @@ -3,17 +3,33 @@ user_idusername_clean + user_permissions + user_sig + user_occ + user_interests 1 anonymous + + + + 3 foo + + + + 4 bar + + + +
diff --git a/tests/session/fixtures/sessions_full.xml b/tests/session/fixtures/sessions_full.xml index bf6fc65997..509687f4d2 100644 --- a/tests/session/fixtures/sessions_full.xml +++ b/tests/session/fixtures/sessions_full.xml @@ -3,17 +3,33 @@
user_idusername_clean + user_permissions + user_sig + user_occ + user_interests 1 anonymous + + + + 3 foo + + + + 4 bar + + + +
-- cgit v1.2.1 From 17991823ea72ef973852fd9d0a9c516703f2137e Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 31 Dec 2011 16:05:02 +0000 Subject: [ticket/9916] Updating License in the header PHPBB3-9916 --- tests/session/append_sid_test.php | 2 +- tests/session/continue_test.php | 2 +- tests/session/init_test.php | 2 +- tests/session/testable_factory.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/session') diff --git a/tests/session/append_sid_test.php b/tests/session/append_sid_test.php index 1a3ad633e3..88f6f0718e 100644 --- a/tests/session/append_sid_test.php +++ b/tests/session/append_sid_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/session/continue_test.php b/tests/session/continue_test.php index 6737562a0a..c4f7f8d75b 100644 --- a/tests/session/continue_test.php +++ b/tests/session/continue_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/session/init_test.php b/tests/session/init_test.php index 1181fab636..2ce6c4a4ac 100644 --- a/tests/session/init_test.php +++ b/tests/session/init_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/session/testable_factory.php b/tests/session/testable_factory.php index f3ef19a257..00f79738ef 100644 --- a/tests/session/testable_factory.php +++ b/tests/session/testable_factory.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -- cgit v1.2.1 From d3bbde69c441a5d795a16e66c9cc7a9194f42218 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 8 Jul 2012 22:53:45 +0200 Subject: [ticket/10973] Drop all require_once for mocks. Use autoloading. PHPBB3-10973 --- tests/session/continue_test.php | 1 - tests/session/init_test.php | 1 - tests/session/testable_factory.php | 3 --- 3 files changed, 5 deletions(-) (limited to 'tests/session') diff --git a/tests/session/continue_test.php b/tests/session/continue_test.php index c4f7f8d75b..ad78d92299 100644 --- a/tests/session/continue_test.php +++ b/tests/session/continue_test.php @@ -7,7 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../mock/cache.php'; require_once dirname(__FILE__) . '/testable_factory.php'; class phpbb_session_continue_test extends phpbb_database_test_case diff --git a/tests/session/init_test.php b/tests/session/init_test.php index 2ce6c4a4ac..830de34ed0 100644 --- a/tests/session/init_test.php +++ b/tests/session/init_test.php @@ -7,7 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../mock/cache.php'; require_once dirname(__FILE__) . '/testable_factory.php'; class phpbb_session_init_test extends phpbb_database_test_case diff --git a/tests/session/testable_factory.php b/tests/session/testable_factory.php index a042085908..cb85a01c5c 100644 --- a/tests/session/testable_factory.php +++ b/tests/session/testable_factory.php @@ -7,9 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../mock/request.php'; -require_once dirname(__FILE__) . '/../mock/session_testable.php'; - /** * This class exists to setup an instance of phpbb's session class for testing. * -- cgit v1.2.1 From 008cf967ab176958126582b58941bd7649732315 Mon Sep 17 00:00:00 2001 From: David King Date: Tue, 21 Aug 2012 11:18:53 -0400 Subject: [feature/add_events] Re-fix broken test PHPBB3-9550 --- tests/session/append_sid_test.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/session') diff --git a/tests/session/append_sid_test.php b/tests/session/append_sid_test.php index 88f6f0718e..34f6dea8ca 100644 --- a/tests/session/append_sid_test.php +++ b/tests/session/append_sid_test.php @@ -45,6 +45,9 @@ class phpbb_session_append_sid_test extends phpbb_test_case */ public function test_append_sid($url, $params, $is_amp, $session_id, $expected, $description) { + global $phpbb_dispatcher; + + $phpbb_dispatcher = new phpbb_mock_event_dispatcher; $this->assertEquals($expected, append_sid($url, $params, $is_amp, $session_id)); } } -- cgit v1.2.1