[ticket/303] Add tests for get_user_groups()

B3P-303
This commit is contained in:
Marc Alexander
2014-07-09 23:22:18 +02:00
parent 75d75df881
commit 1a9dfa8a58
3 changed files with 91 additions and 2 deletions

View File

@@ -9,6 +9,7 @@
require_once(dirname(__FILE__) . '/../../../includes/functions.php');
require_once(dirname(__FILE__) . '/../../../../../../includes/utf/utf_tools.php');
require_once(dirname(__FILE__) . '/../../../../../../includes/functions_content.php');
class phpbb_unit_functions_functions_test extends \board3\portal\tests\testframework\database_test_case
{
@@ -17,6 +18,20 @@ class phpbb_unit_functions_functions_test extends \board3\portal\tests\testframe
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/styles.xml');
}
public function setUp()
{
global $cache, $user;
parent::setUp();
$user = $this->getMock('\phpbb\user', array('optionget'));
$cache = $this->getMock('\phpbb\cache\cache', array('obtain_word_list'));
$cache->expects($this->any())
->method('obtain_word_list')
->with()
->will($this->returnValue(array('match' => array('/disallowed_word/'), 'replace' => array(''))));
}
public function data_sql_table_exists()
{
return array(
@@ -39,7 +54,8 @@ class phpbb_unit_functions_functions_test extends \board3\portal\tests\testframe
return array(
array('test', 'test', 5),
array('foooo...', 'foooooooooobar', 5),
array('wee', 'wee disallowed_word', 5),
array('wee d...', 'wee disallowed_word', 5),
array('test', 'test', 0),
);
}
@@ -48,7 +64,6 @@ class phpbb_unit_functions_functions_test extends \board3\portal\tests\testframe
*/
public function test_character_limit($expected, $input, $length)
{
$this->markTestIncomplete('Cannot test this due to issues with censor_text() and truncate_string()');
$this->assertSame($expected, character_limit($input, $length));
}
}