1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 00:37:42 +02:00

[ticket/13162] Use db tools for truncating

PHPBB3-13162
This commit is contained in:
Marc Alexander
2023-12-17 19:49:23 +01:00
parent c31ac7348a
commit 59f387e828
21 changed files with 103 additions and 118 deletions

View File

@@ -22,6 +22,7 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case
protected $cache_dir;
protected $cache;
protected $db;
protected $db_tools;
protected $config;
protected $user;
@@ -42,6 +43,8 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case
$this->cache = new \phpbb\cache\driver\file($this->cache_dir);
$this->db = $this->createMock('\phpbb\db\driver\driver_interface');
$tools_factory = new \phpbb\db\tools\factory();
$this->db_tools = $this->createMock('\phpbb\db\tools\doctrine');
$this->config = new \phpbb\config\config(array('assets_version' => 1));
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
@@ -86,7 +89,7 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case
public function get_command_tester()
{
$application = new Application();
$application->add(new purge($this->user, $this->cache, $this->db, $this->createMock('\phpbb\auth\auth'), new \phpbb\log\dummy(), $this->config));
$application->add(new purge($this->user, $this->cache, $this->db, $this->db_tools, $this->createMock('\phpbb\auth\auth'), new \phpbb\log\dummy(), $this->config));
$command = $application->find('cache:purge');
return new CommandTester($command);

View File

@@ -16,6 +16,7 @@ require_once __DIR__ . '/../test_framework/phpbb_search_test_case.php';
class phpbb_search_native_test extends phpbb_search_test_case
{
protected $db;
protected $db_tools;
public function getDataSet()
{
@@ -34,11 +35,13 @@ class phpbb_search_native_test extends phpbb_search_test_case
$user = $this->createMock('\phpbb\user');
$this->db = $this->new_dbal();
$tools_factory = new \phpbb\db\tools\factory();
$this->db_tools = $tools_factory->get($this->new_doctrine_dbal());
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$class = self::get_search_wrapper('\phpbb\search\backend\fulltext_native');
$config['fulltext_native_min_chars'] = 2;
$config['fulltext_native_max_chars'] = 14;
$this->search = new $class($config, $this->db, $phpbb_dispatcher, $language, $user, SEARCH_RESULTS_TABLE, SEARCH_WORDLIST_TABLE, SEARCH_WORDMATCH_TABLE, $phpbb_root_path, $phpEx);
$this->search = new $class($config, $this->db, $this->db_tools, $phpbb_dispatcher, $language, $user, SEARCH_RESULTS_TABLE, SEARCH_WORDLIST_TABLE, SEARCH_WORDMATCH_TABLE, $phpbb_root_path, $phpEx);
}
public function keywords()