aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auth/provider_db_test.php
diff options
context:
space:
mode:
authorJoseph Warner <hardolaf@hardolaf.com>2013-06-24 12:05:29 -0400
committerJoseph Warner <hardolaf@hardolaf.com>2013-06-24 12:07:28 -0400
commit80e2d65399e7dcf9b53dada4929d7194275721ad (patch)
treee679d6a25638e74229f4dc45219d04451b9653ce /tests/auth/provider_db_test.php
parentb8610c4b989fd1e4e9e310de776de38dfe4a09a2 (diff)
downloadforums-80e2d65399e7dcf9b53dada4929d7194275721ad.tar
forums-80e2d65399e7dcf9b53dada4929d7194275721ad.tar.gz
forums-80e2d65399e7dcf9b53dada4929d7194275721ad.tar.bz2
forums-80e2d65399e7dcf9b53dada4929d7194275721ad.tar.xz
forums-80e2d65399e7dcf9b53dada4929d7194275721ad.zip
[feature/auth-refactor] Initial auth unit test provider_db
Initial work on a unit test for the provider_db login function. Does not work currently. PHPBB3-9734
Diffstat (limited to 'tests/auth/provider_db_test.php')
-rw-r--r--tests/auth/provider_db_test.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auth/provider_db_test.php b/tests/auth/provider_db_test.php
new file mode 100644
index 0000000000..c6355ae7f9
--- /dev/null
+++ b/tests/auth/provider_db_test.php
@@ -0,0 +1,40 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__).'/../../phpBB/includes/functions.php';
+
+class phpbb_auth_provider_db_test extends phpbb_database_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/user.xml');
+ }
+
+ public function test_login()
+ {
+ global $phpbb_root_path, $phpEx;
+
+ $db = $this->new_dbal();
+ $config = new phpbb_config(array(
+ 'ip_login_limit_max' => 0,
+ 'ip_login_limit_use_forwarded' => 0,
+ 'max_login_attempts' => 0,
+ ));
+ $request = $this->getMock('phpbb_request');
+ $user = $this->getMock('phpbb_user');
+ $provider = new phpbb_auth_provider_db($db, $config, $request, $user, $phpbb_root_path, $phpEx);
+
+ $expected = array(
+ 'status' => LOGIN_SUCCESS,
+ 'error_msg' => false,
+ 'user_row' => '',
+ );
+ $this->assertEquals($expected, $provider->login('example', 'example'));
+ }
+}