mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/11458] Add functional test
Since there is no test method to include extension language files, a functional test seems more appropriate. We add a permission mask 'acl_u_foo' with translation found in extenion 'bar' and confirm that the permission language file 'permissions_foo.php' from 'bar' was added by asserting that 'Can view foo' exists when viewing user permissions in acp PHPBB3-11458
This commit is contained in:
parent
474b4a60a5
commit
84c815a12e
2 changed files with 65 additions and 0 deletions
59
tests/functional/extension_permission_lang_test.php
Normal file
59
tests/functional/extension_permission_lang_test.php
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group functional
|
||||
*/
|
||||
class phpbb_functional_extension_permission_lang_test extends phpbb_functional_test_case
|
||||
{
|
||||
protected $phpbb_extension_manager;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->phpbb_extension_manager = $this->get_extension_manager();
|
||||
|
||||
$this->purge_cache();
|
||||
|
||||
$this->login();
|
||||
$this->admin_login();
|
||||
$this->add_lang('acp/permissions');
|
||||
}
|
||||
|
||||
public function test_auto_include_permission_lang_from_extensions()
|
||||
{
|
||||
$this->phpbb_extension_manager->enable('foo/bar');
|
||||
|
||||
// User permissions
|
||||
$crawler = $this->request('GET', 'adm/index.php?i=acp_permissions&icat=16&mode=setting_user_global&sid=' . $this->sid);
|
||||
$this->assert_response_success();
|
||||
$this->assertContains('Can view foo', $this->client->getResponse()->getContent());
|
||||
}
|
||||
|
||||
public function permissions_data()
|
||||
{
|
||||
return array(
|
||||
// description
|
||||
// permission type
|
||||
// permission name
|
||||
// mode
|
||||
// object name
|
||||
// object id
|
||||
array(
|
||||
'user permission',
|
||||
'u_',
|
||||
'acl_u_foo',
|
||||
'setting_user_global',
|
||||
'user_id',
|
||||
2,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
// Admin Permissions
|
||||
$lang = array_merge($lang, array(
|
||||
'acl_u_foo' => array('lang' => 'Can view foo', 'cat' => 'misc'),
|
||||
));
|
Loading…
Add table
Reference in a new issue