1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-13 20:24:08 +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

@@ -54,6 +54,8 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$this->config = new \phpbb\config\db($this->db, new phpbb_mock_cache, 'phpbb_config');
$finder_factory = $this->createMock('\phpbb\finder\factory');
$tools = array(
new \phpbb\db\migration\tool\config($this->config),
);
@@ -80,9 +82,9 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$container,
$this->db,
$this->config,
$finder_factory,
'phpbb_ext',
__DIR__ . '/../../phpBB/',
'php',
null
);
}

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
);

View File

@@ -23,6 +23,7 @@ class phpbb_mock_container_builder implements ContainerInterface
$this->setParameter('debug.load_time', false);
$this->setParameter('session.log_errors', false);
$this->setParameter('session.force_sid', true);
$this->setParameter('finder.not_use_cache', false);
}
/**

View File

@@ -19,11 +19,11 @@ class phpbb_mock_extension_manager extends \phpbb\extension\manager
$lang = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = 'php';
$this->extensions = $extensions;
$this->filesystem = new \phpbb\filesystem\filesystem();
$this->container = $container;
$this->config = new \phpbb\config\config(array());
$this->user = new \phpbb\user($lang,'\phpbb\datetime');
$this->finder_factory = new \phpbb\finder\factory(null, true, $this->phpbb_root_path, $phpEx);
}
}

View File

@@ -74,7 +74,7 @@ abstract class phpbb_database_test_case extends TestCase
$setup_extensions = static::setup_extensions();
$finder = new \phpbb\finder($phpbb_root_path, null, $phpEx);
$finder = new \phpbb\finder\finder(null, true, $phpbb_root_path, $phpEx);
$finder->core_path('phpbb/db/migration/data/');
if (!empty($setup_extensions))
{

View File

@@ -365,7 +365,7 @@ class phpbb_database_test_connection_manager
{
global $phpbb_root_path, $phpEx, $table_prefix;
$finder = new \phpbb\finder($phpbb_root_path, null, $phpEx);
$finder = new \phpbb\finder\finder(null, true, $phpbb_root_path, $phpEx);
$classes = $finder->core_path('phpbb/db/migration/data/')
->get_classes();

View File

@@ -239,6 +239,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$config = new \phpbb\config\config(array('version' => PHPBB_VERSION));
$db = $this->get_db();
$factory = new \phpbb\db\tools\factory();
$finder_factory = new \phpbb\finder\factory(null, false, $phpbb_root_path, $phpEx);
$db_tools = $factory->get($db);
$container = new phpbb_mock_container_builder();
@@ -262,9 +263,9 @@ class phpbb_functional_test_case extends phpbb_test_case
$container,
$db,
$config,
$finder_factory,
self::$config['table_prefix'] . 'ext',
__DIR__ . '/',
$phpEx,
new \phpbb\cache\service($this->get_cache_driver(), $config, $this->db, $phpbb_root_path, $phpEx)
);