2013-04-13 11:24:47 -04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
*
|
2014-05-27 20:18:06 +02:00
|
|
|
* 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.
|
2013-04-13 11:24:47 -04:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group functional
|
|
|
|
*/
|
|
|
|
class phpbb_functional_extension_permission_lang_test extends phpbb_functional_test_case
|
|
|
|
{
|
|
|
|
protected $phpbb_extension_manager;
|
|
|
|
|
2013-05-09 23:12:19 -04:00
|
|
|
static private $helper;
|
|
|
|
|
2013-04-14 17:53:38 -04:00
|
|
|
static protected $fixtures = array(
|
2013-11-14 00:14:53 +01:00
|
|
|
'foo/bar/config/',
|
2013-07-17 17:27:15 +02:00
|
|
|
'foo/bar/event/',
|
2013-11-14 00:14:53 +01:00
|
|
|
'foo/bar/language/en/',
|
2013-04-14 17:53:38 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
static public function setUpBeforeClass()
|
|
|
|
{
|
|
|
|
parent::setUpBeforeClass();
|
|
|
|
|
2017-05-07 03:26:01 +07:00
|
|
|
self::$helper = new phpbb_test_case_helpers(__CLASS__);
|
2013-06-08 17:02:31 +02:00
|
|
|
self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures);
|
2013-04-14 17:53:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static public function tearDownAfterClass()
|
|
|
|
{
|
2013-06-08 17:02:31 +02:00
|
|
|
parent::tearDownAfterClass();
|
2013-05-09 23:12:19 -04:00
|
|
|
|
2013-06-08 17:02:31 +02:00
|
|
|
self::$helper->restore_original_ext_dir();
|
2013-04-14 17:53:38 -04:00
|
|
|
}
|
|
|
|
|
2013-04-13 11:24:47 -04:00
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
parent::setUp();
|
2013-04-14 17:53:38 -04:00
|
|
|
|
|
|
|
$this->get_db();
|
|
|
|
|
|
|
|
$acl_ary = array(
|
|
|
|
'auth_option' => 'u_foo',
|
|
|
|
'is_global' => 1,
|
|
|
|
);
|
|
|
|
|
|
|
|
$sql = 'INSERT INTO phpbb_acl_options ' . $this->db->sql_build_array('INSERT', $acl_ary);
|
|
|
|
$this->db->sql_query($sql);
|
2013-04-13 11:24:47 -04:00
|
|
|
|
|
|
|
$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
|
2013-05-31 16:45:06 +02:00
|
|
|
$crawler = self::request('GET', 'adm/index.php?i=acp_permissions&icat=16&mode=setting_user_global&sid=' . $this->sid);
|
2013-04-13 13:56:02 -04:00
|
|
|
|
|
|
|
// Select admin
|
|
|
|
$form = $crawler->selectButton($this->lang('SUBMIT'))->form();
|
|
|
|
$data = array('username[0]' => 'admin');
|
|
|
|
$form->setValues($data);
|
2013-05-31 16:45:06 +02:00
|
|
|
$crawler = self::submit($form);
|
2013-05-11 02:38:40 -04:00
|
|
|
|
|
|
|
// language from language/en/acp/permissions_phpbb.php
|
|
|
|
$this->assertContains('Can attach files', $crawler->filter('body')->text());
|
|
|
|
|
|
|
|
// language from ext/foo/bar/language/en/permissions_foo.php
|
2013-07-14 12:55:03 -04:00
|
|
|
$this->assertContains('Can view foobar', $crawler->filter('body')->text());
|
2013-04-13 11:24:47 -04:00
|
|
|
}
|
|
|
|
}
|