aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mock
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-07-11 11:41:48 +0200
committerJoas Schilling <nickvergessen@gmx.de>2013-07-11 11:41:48 +0200
commitbdb7ec0ceb3210955b2457bfe6fe469b1781d8d6 (patch)
tree4a6cd814385ae839f577866d3c45175f9ea4928e /tests/mock
parentd41cf293e1609be9d0cc08e5ccd37947481e61ca (diff)
parent2fcae1ca16d096d2839b487e8c1bcbe0f313d91f (diff)
downloadforums-bdb7ec0ceb3210955b2457bfe6fe469b1781d8d6.tar
forums-bdb7ec0ceb3210955b2457bfe6fe469b1781d8d6.tar.gz
forums-bdb7ec0ceb3210955b2457bfe6fe469b1781d8d6.tar.bz2
forums-bdb7ec0ceb3210955b2457bfe6fe469b1781d8d6.tar.xz
forums-bdb7ec0ceb3210955b2457bfe6fe469b1781d8d6.zip
Merge remote-tracking branch 'phpbb/develop' into feature/softdelete-1-permission
* phpbb/develop: (704 commits) [ticket/11630] Improvements to the PHP lint pre-commit hook [feature/auth-refactor] Move auth providers to separate directory [ticket/11619] Use HTTP/1.0 because of lack of chunked-encoding handling. [ticket/11619] Some tests for get_remote_file(). [ticket/11617] Remove spaces and tabs from empty lines [ticket/11617] Missing U_ACTION in acp_captcha.php [feature/auth-refactor] Fix code style issue [feature/auth-refactor] Fix comment grammar [feature/auth-refactor] Fix the actual cause of test failures [ticket/10838] Fix URL for wiki and remove irrelevant line [ticket/10838] Remove php 5.4 and builtin server references [ticket/10838] Fix missing data [ticket/10838] separate database used mentioned in unit tests [ticket/11585] Make $auth_admin class property [feature/auth-refactor] A possible fix for the functional test failures [ticket/11566] Subsilver template error displayed after table headers [ticket/11566] Remove extra pair of brackets from conditional statement [ticket/11566] Check that guest doesn't have reporting permission by default [ticket/11566] Add captcha to report post template in subsilver [ticket/11566] Use the new constant CONFIRM_REPORT for captcha init ... Conflicts: phpBB/docs/sphinx.sample.conf phpBB/feed.php phpBB/styles/prosilver/template/search_results.html phpBB/styles/prosilver/template/viewforum_body.html
Diffstat (limited to 'tests/mock')
-rw-r--r--tests/mock/cache.php15
-rw-r--r--tests/mock/extension_manager.php3
-rw-r--r--tests/mock/lang.php5
-rw-r--r--tests/mock/metadata_manager.php21
-rw-r--r--tests/mock/notifications_notification_manager.php69
-rw-r--r--tests/mock/user.php13
6 files changed, 56 insertions, 70 deletions
diff --git a/tests/mock/cache.php b/tests/mock/cache.php
index 71af3037f5..440592665a 100644
--- a/tests/mock/cache.php
+++ b/tests/mock/cache.php
@@ -53,6 +53,21 @@ class phpbb_mock_cache implements phpbb_cache_driver_interface
);
}
+ /**
+ * Obtain disallowed usernames. Input data via standard put method.
+ */
+ public function obtain_disallowed_usernames()
+ {
+ if (($usernames = $this->get('_disallowed_usernames')) !== false)
+ {
+ return $usernames;
+ }
+ else
+ {
+ return array();
+ }
+ }
+
public function checkVar(PHPUnit_Framework_Assert $test, $var_name, $data)
{
$test->assertTrue(isset($this->data[$var_name]));
diff --git a/tests/mock/extension_manager.php b/tests/mock/extension_manager.php
index fdda4cbadc..10b3595206 100644
--- a/tests/mock/extension_manager.php
+++ b/tests/mock/extension_manager.php
@@ -12,7 +12,8 @@ class phpbb_mock_extension_manager extends phpbb_extension_manager
public function __construct($phpbb_root_path, $extensions = array())
{
$this->phpbb_root_path = $phpbb_root_path;
- $this->php_ext = '.php';
+ $this->php_ext = 'php';
$this->extensions = $extensions;
+ $this->filesystem = new phpbb_filesystem();
}
}
diff --git a/tests/mock/lang.php b/tests/mock/lang.php
index 781b3d060e..ac814b45db 100644
--- a/tests/mock/lang.php
+++ b/tests/mock/lang.php
@@ -30,4 +30,9 @@ class phpbb_mock_lang implements ArrayAccess
public function offsetUnset($offset)
{
}
+
+ public function lang()
+ {
+ return implode(' ', func_get_args());
+ }
}
diff --git a/tests/mock/metadata_manager.php b/tests/mock/metadata_manager.php
new file mode 100644
index 0000000000..a7fbf0681c
--- /dev/null
+++ b/tests/mock/metadata_manager.php
@@ -0,0 +1,21 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_mock_metadata_manager extends phpbb_extension_metadata_manager
+{
+ public function set_metadata($metadata)
+ {
+ $this->metadata = $metadata;
+ }
+
+ public function merge_metadata($metadata)
+ {
+ $this->metadata = array_merge($this->metadata, $metadata);
+ }
+}
diff --git a/tests/mock/notifications_notification_manager.php b/tests/mock/notifications_notification_manager.php
deleted file mode 100644
index c995afb9ab..0000000000
--- a/tests/mock/notifications_notification_manager.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-/**
-*
-* @package notifications
-* @copyright (c) 2012 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Notifications service class
-* @package notifications
-*/
-class phpbb_mock_notifications_notification_manager extends phpbb_notification_manager
-{
- public function set_var($name, $value)
- {
- $this->$name = $value;
- }
-
- // Extra dependencies for get_*_class functions
- protected $auth = null;
- protected $cache = null;
- protected $config = null;
- public function setDependencies($auth, $cache, $config)
- {
- $this->auth = $auth;
- $this->cache = $cache;
- $this->config = $config;
- }
-
- /**
- * Helper to get the notifications item type class and set it up
- */
- public function get_item_type_class($item_type, $data = array())
- {
- $item_type = 'phpbb_notification_type_' . $item_type;
-
- $item = new $item_type($this->user_loader, $this->db, $this->cache, $this->user, $this->auth, $this->config, $this->phpbb_root_path, $this->php_ext, $this->notification_types_table, $this->notifications_table, $this->user_notifications_table);
-
- $item->set_notification_manager($this);
-
- $item->set_initial_data($data);
-
- return $item;
- }
-
- /**
- * Helper to get the notifications method class and set it up
- */
- public function get_method_class($method_name)
- {
- $method_name = 'phpbb_notification_method_' . $method_name;
-
- $method = new $method_name($this->user_loader, $this->db, $this->cache, $this->user, $this->auth, $this->config, $this->phpbb_root_path, $this->php_ext, $this->notification_types_table, $this->notifications_table, $this->user_notifications_table);
-
- $method->set_notification_manager($this);
-
- return $method;
- }
-}
diff --git a/tests/mock/user.php b/tests/mock/user.php
index ec14ce430e..bd547b3973 100644
--- a/tests/mock/user.php
+++ b/tests/mock/user.php
@@ -33,4 +33,17 @@ class phpbb_mock_user
{
$this->options[$item] = $value;
}
+
+ public function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false)
+ {
+ $banned_users = $this->optionget('banned_users');
+ foreach ($banned_users as $banned)
+ {
+ if ($banned == $user_id || $banned == $user_ips || $banned == $user_email)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
}