mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/12508] Add a unit test for set_extensions()
PHPBB3-12508
This commit is contained in:
parent
6980fbd27b
commit
fb3c6b94ae
1 changed files with 43 additions and 0 deletions
|
@ -14,7 +14,9 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||||
|
|
||||||
class phpbb_extension_finder_test extends phpbb_test_case
|
class phpbb_extension_finder_test extends phpbb_test_case
|
||||||
{
|
{
|
||||||
|
/** @var \phpbb\extension\manager */
|
||||||
protected $extension_manager;
|
protected $extension_manager;
|
||||||
|
/** @var \phpbb\finder */
|
||||||
protected $finder;
|
protected $finder;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
|
@ -56,6 +58,47 @@ class phpbb_extension_finder_test extends phpbb_test_case
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function set_extensions_data()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array(
|
||||||
|
array(),
|
||||||
|
array('\phpbb\default\implementation'),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array('vendor3/bar'),
|
||||||
|
array(
|
||||||
|
'\phpbb\default\implementation',
|
||||||
|
'\vendor3\bar\my\hidden_class',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array('vendor2/foo', 'vendor3/bar'),
|
||||||
|
array(
|
||||||
|
'\phpbb\default\implementation',
|
||||||
|
'\vendor2\foo\a_class',
|
||||||
|
'\vendor2\foo\b_class',
|
||||||
|
'\vendor3\bar\my\hidden_class',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider set_extensions_data
|
||||||
|
*/
|
||||||
|
public function test_set_extensions($extensions, $expected)
|
||||||
|
{
|
||||||
|
$classes = $this->finder
|
||||||
|
->set_extensions($extensions)
|
||||||
|
->core_path('phpbb/default/')
|
||||||
|
->extension_suffix('_class')
|
||||||
|
->get_classes();
|
||||||
|
|
||||||
|
sort($classes);
|
||||||
|
$this->assertEquals($expected, $classes);
|
||||||
|
}
|
||||||
|
|
||||||
public function test_get_directories()
|
public function test_get_directories()
|
||||||
{
|
{
|
||||||
$dirs = $this->finder
|
$dirs = $this->finder
|
||||||
|
|
Loading…
Add table
Reference in a new issue