aboutsummaryrefslogtreecommitdiffstats
path: root/tests/session
diff options
context:
space:
mode:
authorMaat <maat-pub@mageia.biz>2020-05-08 21:52:11 +0200
committerMaat <maat-pub@mageia.biz>2020-05-08 21:52:11 +0200
commit8ea437e30605e0f66b5220bf904a61d7c1d11ddd (patch)
treee0db2bb4a012d5b06a633160b19f62f4868ecd28 /tests/session
parent36bc1870f21fac04736a1049c1d5b8e127d729f4 (diff)
parent2fdd46b36431ae0f58bb2e78e42553168db9a0ff (diff)
downloadforums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.gz
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.bz2
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.xz
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.zip
Merge remote-tracking branch 'upstream/prep-release-3.2.9'
Diffstat (limited to 'tests/session')
-rw-r--r--tests/session/append_sid_test.php2
-rw-r--r--tests/session/check_ban_test.php8
-rw-r--r--tests/session/extract_page_test.php19
-rw-r--r--tests/session/garbage_collection_test.php1
-rw-r--r--tests/session/session_key_test.php1
-rw-r--r--tests/session/testable_factory.php6
6 files changed, 26 insertions, 11 deletions
diff --git a/tests/session/append_sid_test.php b/tests/session/append_sid_test.php
index 2a1d94514f..4e5a238644 100644
--- a/tests/session/append_sid_test.php
+++ b/tests/session/append_sid_test.php
@@ -11,8 +11,6 @@
*
*/
-require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
-
class phpbb_session_append_sid_test extends phpbb_test_case
{
diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php
index 561b7faf49..16a65b0ade 100644
--- a/tests/session/check_ban_test.php
+++ b/tests/session/check_ban_test.php
@@ -42,7 +42,10 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case
parent::setUp();
// Get session here so that config is mocked correctly
$this->session = $this->session_factory->get_session($this->db);
- global $cache, $config, $phpbb_root_path, $phpEx;
+ global $cache, $config, $phpbb_root_path, $phpEx, $phpbb_filesystem;
+
+ $phpbb_filesystem = new \phpbb\filesystem\filesystem();
+
$this->backup_cache = $cache;
// Change the global cache object for this test because
// the mock cache object does not hit the database as is needed
@@ -69,7 +72,8 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case
{
try
{
- $is_banned = $this->session->check_ban($user_id, $user_ips, $user_email, $return);
+ $ban = $this->session->check_ban($user_id, $user_ips, $user_email, $return);
+ $is_banned = !empty($ban);
}
catch (PHPUnit_Framework_Error_Notice $e)
{
diff --git a/tests/session/extract_page_test.php b/tests/session/extract_page_test.php
index f0d1cdb60e..f8aa3d27a5 100644
--- a/tests/session/extract_page_test.php
+++ b/tests/session/extract_page_test.php
@@ -12,7 +12,6 @@
*/
require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
class phpbb_session_extract_page_test extends phpbb_session_test_case
{
@@ -137,6 +136,22 @@ class phpbb_session_extract_page_test extends phpbb_session_test_case
'forum' => 0,
),
),
+ array(
+ './community',
+ '/app.php',
+ '',
+ '/',
+ '/kb',
+ array(
+ 'page_name' => 'app.php/kb',
+ 'page_dir' => '..',
+ 'query_string' => '',
+ 'script_path' => '/',
+ 'root_script_path' => '/community/',
+ 'page' => '../app.php/kb',
+ 'forum' => 0,
+ ),
+ ),
);
}
@@ -145,7 +160,7 @@ class phpbb_session_extract_page_test extends phpbb_session_test_case
{
global $symfony_request, $request, $phpbb_filesystem;
- $phpbb_filesystem = new \phpbb\filesystem();
+ $phpbb_filesystem = new \phpbb\filesystem\filesystem();
$server['HTTP_HOST'] = 'localhost';
$server['SERVER_NAME'] = 'localhost';
diff --git a/tests/session/garbage_collection_test.php b/tests/session/garbage_collection_test.php
index 3fad81c68b..3dc591a328 100644
--- a/tests/session/garbage_collection_test.php
+++ b/tests/session/garbage_collection_test.php
@@ -12,7 +12,6 @@
*/
require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
class phpbb_session_garbage_collection_test extends phpbb_session_test_case
{
diff --git a/tests/session/session_key_test.php b/tests/session/session_key_test.php
index bf3dfcaa3c..2499ea1d55 100644
--- a/tests/session/session_key_test.php
+++ b/tests/session/session_key_test.php
@@ -11,7 +11,6 @@
*
*/
-require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php';
class phpbb_session_login_keys_test extends phpbb_session_test_case
diff --git a/tests/session/testable_factory.php b/tests/session/testable_factory.php
index 3e25286480..6f8b49122b 100644
--- a/tests/session/testable_factory.php
+++ b/tests/session/testable_factory.php
@@ -73,7 +73,7 @@ class phpbb_session_testable_factory
public function get_session(\phpbb\db\driver\driver_interface $dbal)
{
// set up all the global variables used by session
- global $SID, $_SID, $db, $config, $cache, $request, $phpbb_container;
+ global $SID, $_SID, $db, $config, $cache, $request, $phpbb_container, $phpbb_root_path;
$request = $this->request = new phpbb_mock_request(
array(),
@@ -81,10 +81,8 @@ class phpbb_session_testable_factory
$this->cookies,
$this->server_data
);
- request_var(null, null, null, null, $request);
$config = $this->config = new \phpbb\config\config($this->get_config_data());
- set_config(null, null, null, $config);
$db = $dbal;
@@ -96,6 +94,8 @@ class phpbb_session_testable_factory
'auth.provider.db',
new phpbb_mock_auth_provider()
);
+ $phpbb_container->setParameter('core.environment', PHPBB_ENVIRONMENT);
+ $phpbb_container->setParameter('core.cache_dir', $phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT . '/');
$provider_collection = new \phpbb\auth\provider_collection($phpbb_container, $config);
$provider_collection->add('auth.provider.db');
$phpbb_container->set(