mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-29 14:48:53 +00:00
[ticket/11600] Use local variable for $user in test_localize_errors
PHPBB3-11600
This commit is contained in:
parent
25acf3f74c
commit
72377075f4
1 changed files with 5 additions and 7 deletions
|
@ -11,8 +11,6 @@ require_once dirname(__FILE__) . '/driver/foobar.php';
|
||||||
|
|
||||||
class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
|
class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
protected $user;
|
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_root_path, $phpEx;
|
||||||
|
@ -230,23 +228,23 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function test_localize_errors()
|
public function test_localize_errors()
|
||||||
{
|
{
|
||||||
$this->user = $this->getMock('phpbb_user');
|
$user = $this->getMock('phpbb_user');
|
||||||
$lang_array = array(
|
$lang_array = array(
|
||||||
array('FOOBAR_OFF', 'foobar_off'),
|
array('FOOBAR_OFF', 'foobar_off'),
|
||||||
array('FOOBAR_EXPLAIN', 'FOOBAR_EXPLAIN %s'),
|
array('FOOBAR_EXPLAIN', 'FOOBAR_EXPLAIN %s'),
|
||||||
);
|
);
|
||||||
$this->user->expects($this->any())
|
$user->expects($this->any())
|
||||||
->method('lang')
|
->method('lang')
|
||||||
->will($this->returnValueMap($lang_array));
|
->will($this->returnValueMap($lang_array));
|
||||||
|
|
||||||
// Pass error as string
|
// Pass error as string
|
||||||
$this->assertEquals(array('foobar_off'), $this->manager->localize_errors($this->user, array('FOOBAR_OFF')));
|
$this->assertEquals(array('foobar_off'), $this->manager->localize_errors($user, array('FOOBAR_OFF')));
|
||||||
|
|
||||||
// Pass error as array for vsprintf()
|
// Pass error as array for vsprintf()
|
||||||
$this->assertEquals(array('FOOBAR_EXPLAIN foo'), $this->manager->localize_errors($this->user, array(array('FOOBAR_EXPLAIN', 'foo'))));
|
$this->assertEquals(array('FOOBAR_EXPLAIN foo'), $this->manager->localize_errors($user, array(array('FOOBAR_EXPLAIN', 'foo'))));
|
||||||
|
|
||||||
// Pass both types
|
// Pass both types
|
||||||
$this->assertEquals(array('foobar_off', 'FOOBAR_EXPLAIN foo'), $this->manager->localize_errors($this->user, array(
|
$this->assertEquals(array('foobar_off', 'FOOBAR_EXPLAIN foo'), $this->manager->localize_errors($user, array(
|
||||||
'FOOBAR_OFF',
|
'FOOBAR_OFF',
|
||||||
array('FOOBAR_EXPLAIN', 'foo'),
|
array('FOOBAR_EXPLAIN', 'foo'),
|
||||||
)));
|
)));
|
||||||
|
|
Loading…
Add table
Reference in a new issue