aboutsummaryrefslogtreecommitdiff
blob: 5efd8ad95ed71495147f3ad3f2ec8701126075d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
 *
 * This file is part of the phpBB Forum Software package.
 *
 * @copyright (c) phpBB Limited <https://www.phpbb.com>
 * @license GNU General Public License, version 2 (GPL-2.0)
 *
 * For full copyright and license information, please see
 * the docs/CREDITS.txt file.
 *
 */

require_once dirname(__FILE__) . '/helper_test_case.php';

class phpbb_group_helper_get_rank_test extends phpbb_group_helper_test_case
{
	public function get_rank_data()
	{
		global $phpbb_root_path;

		return array(
			array(
				array('group_id' => 0, 'group_rank' => 1),
				array(
					'title' => 'Site admin',
					'img' => '<img src="' . $phpbb_root_path . 'images/ranks/siteadmin.png' . '" alt="Site admin" title="Site admin" />',
					'img_src' => $phpbb_root_path . 'images/ranks/siteadmin.png',
				)
			),
			array(array('group_id' => 1, 'group_rank' => 0), array('title' => null, 'img' => null, 'img_src' => null)),
			array(array('group_id' => 2, 'group_rank' => 2), array('title' => 'Test member', 'img' => '', 'img_src' => '')),
		);
	}

	/**
	 * @dataProvider get_rank_data
	 */
	public function test_get_rank($group_data, $expected)
	{
		$this->assertEquals($expected, $this->group_helper->get_rank($group_data));
	}
}