1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-16 13:44:12 +02:00

[ticket/12631] Add finder.not_use_cache

PHPBB3-12631
This commit is contained in:
Rubén Calvo
2018-09-01 01:32:22 +02:00
committed by Marc Alexander
parent 38024d14bf
commit 9308764fae
22 changed files with 136 additions and 42 deletions

View File

@@ -15,7 +15,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
{
/** @var \phpbb\extension\manager */
protected $extension_manager;
/** @var \phpbb\finder */
/** @var \phpbb\finder\finder */
protected $finder;
protected function setUp(): void
@@ -243,7 +243,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
public function test_get_classes_create_cache()
{
$cache = new phpbb_mock_cache;
$finder = new \phpbb\finder(__DIR__ . '/', $cache, 'php', '_custom_cache_name');
$finder = new \phpbb\finder\finder($cache, true, __DIR__ . '/', 'php', '_custom_cache_name');
$finder->set_extensions(array_keys($this->extension_manager->all_enabled()));
$files = $finder->suffix('_class.php')->get_files();
@@ -282,13 +282,15 @@ class phpbb_extension_finder_test extends phpbb_test_case
'is_dir' => false,
);
$finder = new \phpbb\finder(
__DIR__ . '/',
$finder = new \phpbb\finder\finder(
new phpbb_mock_cache(array(
'_ext_finder' => array(
md5(serialize($query)) => array('file_name' => 'extension'),
),
))
)),
true,
__DIR__ . '/',
'_ext_finder'
);
$finder->set_extensions(array_keys($this->extension_manager->all_enabled()));

View File

@@ -147,13 +147,14 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
protected function create_extension_manager($with_cache = true)
{
$phpbb_root_path = __DIR__ . './../../phpBB/';
$php_ext = 'php';
$config = new \phpbb\config\config(array('version' => PHPBB_VERSION));
$db = $this->new_dbal();
$factory = new \phpbb\db\tools\factory();
$finder_factory = new \phpbb\finder\factory(null, false, $phpbb_root_path, $php_ext);
$db_tools = $factory->get($db);
$phpbb_root_path = __DIR__ . './../../phpBB/';
$php_ext = 'php';
$table_prefix = 'phpbb_';
$container = new phpbb_mock_container_builder();
@@ -177,9 +178,9 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$container,
$db,
$config,
$finder_factory,
'phpbb_ext',
__DIR__ . '/',
$php_ext,
($with_cache) ? new \phpbb\cache\service(new phpbb_mock_cache(), $config, $db, $phpbb_root_path, $php_ext) : null
);
}

View File

@@ -42,6 +42,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->db = $this->new_dbal();
$factory = new \phpbb\db\tools\factory();
$this->db_tools = $factory->get($this->db);
$finder_factory = $this->createMock('\phpbb\finder\factory');
$this->phpbb_root_path = __DIR__ . '/';
$this->phpEx = 'php';
@@ -97,9 +98,9 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$container,
$this->db,
$this->config,
$finder_factory,
'phpbb_ext',
$this->phpbb_root_path,
$this->phpEx,
$this->cache
);