aboutsummaryrefslogtreecommitdiffstats
path: root/tests/user
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2013-03-15 01:32:33 +0100
committerAndreas Fischer <bantu@phpbb.com>2013-03-15 01:32:33 +0100
commitef1caf69332bed24a12fdeda98711f5012c85ebd (patch)
tree18ed85bcd1a672e0989df477444a830fb911114a /tests/user
parente1e9138c3b706d686dc176f7ccb3dfc95cbf0bb4 (diff)
downloadforums-ef1caf69332bed24a12fdeda98711f5012c85ebd.tar
forums-ef1caf69332bed24a12fdeda98711f5012c85ebd.tar.gz
forums-ef1caf69332bed24a12fdeda98711f5012c85ebd.tar.bz2
forums-ef1caf69332bed24a12fdeda98711f5012c85ebd.tar.xz
forums-ef1caf69332bed24a12fdeda98711f5012c85ebd.zip
[ticket/11441] Use setUp() in phpbb_user_loader_test.
PHPBB3-11441
Diffstat (limited to 'tests/user')
-rw-r--r--tests/user/user_loader_test.php27
1 files changed, 17 insertions, 10 deletions
diff --git a/tests/user/user_loader_test.php b/tests/user/user_loader_test.php
index c030e7ff97..89659256f8 100644
--- a/tests/user/user_loader_test.php
+++ b/tests/user/user_loader_test.php
@@ -11,38 +11,45 @@ include_once(__DIR__ . '/../../phpBB/includes/utf/utf_tools.php');
class phpbb_user_loader_test extends phpbb_database_test_case
{
+ protected $db;
+ protected $user_loader;
+
public function getDataSet()
{
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/user_loader.xml');
}
- public function test_user_loader()
+ public function setUp()
{
- $db = $this->new_dbal();
+ parent::setUp();
- $user_loader = new phpbb_user_loader($db, __DIR__ . '/../../phpBB/', 'php', 'phpbb_users');
+ $this->db = $this->new_dbal();
+ $this->user_loader = new phpbb_user_loader($this->db, __DIR__ . '/../../phpBB/', 'php', 'phpbb_users');
+ }
- $user_loader->load_users(array(2));
+ public function test_user_loader()
+ {
+ $this->user_loader->load_users(array(2));
- $user = $user_loader->get_user(1);
+ $user = $this->user_loader->get_user(1);
$this->assertEquals(1, $user['user_id']);
$this->assertEquals('Guest', $user['username']);
- $user = $user_loader->get_user(2);
+ $user = $this->user_loader->get_user(2);
$this->assertEquals(2, $user['user_id']);
$this->assertEquals('Admin', $user['username']);
// Not loaded
- $user = $user_loader->get_user(3);
+ $user = $this->user_loader->get_user(3);
$this->assertEquals(1, $user['user_id']);
$this->assertEquals('Guest', $user['username']);
- $user = $user_loader->get_user(3, true);
+ $user = $this->user_loader->get_user(3, true);
$this->assertEquals(3, $user['user_id']);
$this->assertEquals('Test', $user['username']);
- $user_id = $user_loader->load_user_by_username('Test');
- $user = $user_loader->get_user($user_id);
+ $user_id = $this->user_loader->load_user_by_username('Test');
+ $user = $this->user_loader->get_user($user_id);
$this->assertEquals(3, $user['user_id']);
$this->assertEquals('Test', $user['username']);
}