mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/15540] Fix test
PHPBB3-15540
This commit is contained in:
parent
656e57fbf6
commit
cd8c09d0b3
10 changed files with 30 additions and 33 deletions
|
@ -4,7 +4,6 @@ services:
|
|||
search.fulltext.native:
|
||||
class: phpbb\search\backend\fulltext_native
|
||||
arguments:
|
||||
- '@cache'
|
||||
- '@config'
|
||||
- '@dbal.conn'
|
||||
- '@dispatcher'
|
||||
|
@ -18,7 +17,6 @@ services:
|
|||
search.fulltext.mysql:
|
||||
class: phpbb\search\backend\fulltext_mysql
|
||||
arguments:
|
||||
- '@cache'
|
||||
- '@config'
|
||||
- '@dbal.conn'
|
||||
- '@dispatcher'
|
||||
|
@ -32,7 +30,6 @@ services:
|
|||
search.fulltext.postgres:
|
||||
class: phpbb\search\backend\fulltext_postgres
|
||||
arguments:
|
||||
- '@cache'
|
||||
- '@config'
|
||||
- '@dbal.conn'
|
||||
- '@dispatcher'
|
||||
|
|
18
phpBB/phpbb/cache/service.php
vendored
18
phpBB/phpbb/cache/service.php
vendored
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace phpbb\cache;
|
||||
|
||||
use phpbb\cache\driver\driver_interface;
|
||||
use phpbb\config\config;
|
||||
use phpbb\json\sanitizer as json_sanitizer;
|
||||
|
||||
/**
|
||||
|
@ -23,14 +25,14 @@ class service
|
|||
/**
|
||||
* Cache driver.
|
||||
*
|
||||
* @var \phpbb\cache\driver\driver_interface
|
||||
* @var driver_interface
|
||||
*/
|
||||
protected $driver;
|
||||
|
||||
/**
|
||||
* The config.
|
||||
*
|
||||
* @var \phpbb\config\config
|
||||
* @var config
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
|
@ -58,13 +60,13 @@ class service
|
|||
/**
|
||||
* Creates a cache service around a cache driver
|
||||
*
|
||||
* @param \phpbb\cache\driver\driver_interface $driver The cache driver
|
||||
* @param \phpbb\config\config $config The config
|
||||
* @param driver_interface $driver The cache driver
|
||||
* @param config $config The config
|
||||
* @param \phpbb\db\driver\driver_interface $db Database connection
|
||||
* @param string $phpbb_root_path Root path
|
||||
* @param string $php_ext PHP file extension
|
||||
*/
|
||||
public function __construct(\phpbb\cache\driver\driver_interface $driver, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, $phpbb_root_path, $php_ext)
|
||||
public function __construct(driver_interface $driver, config $config, \phpbb\db\driver\driver_interface $db, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
$this->set_driver($driver);
|
||||
$this->config = $config;
|
||||
|
@ -76,7 +78,7 @@ class service
|
|||
/**
|
||||
* Returns the cache driver used by this cache service.
|
||||
*
|
||||
* @return \phpbb\cache\driver\driver_interface The cache driver
|
||||
* @return driver_interface The cache driver
|
||||
*/
|
||||
public function get_driver()
|
||||
{
|
||||
|
@ -86,9 +88,9 @@ class service
|
|||
/**
|
||||
* Replaces the cache driver used by this cache service.
|
||||
*
|
||||
* @param \phpbb\cache\driver\driver_interface $driver The cache driver
|
||||
* @param driver_interface $driver The cache driver
|
||||
*/
|
||||
public function set_driver(\phpbb\cache\driver\driver_interface $driver)
|
||||
public function set_driver(driver_interface $driver)
|
||||
{
|
||||
$this->driver = $driver;
|
||||
}
|
||||
|
|
|
@ -98,12 +98,12 @@ class create_search_index extends database_task
|
|||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param config $config Installer config.
|
||||
* @param database $db_helper Database helper.
|
||||
* @param container_factory $container Installer's DI container
|
||||
* @param iohandler_interface $iohandler IO manager.
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param string $php_ext PHP file extension
|
||||
* @param config $config Installer config.
|
||||
* @param database $db_helper Database helper.
|
||||
* @param container_factory $container Installer's DI container
|
||||
* @param iohandler_interface $iohandler IO manager.
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param string $php_ext PHP file extension
|
||||
*/
|
||||
public function __construct(
|
||||
config $config,
|
||||
|
@ -127,11 +127,11 @@ class create_search_index extends database_task
|
|||
|
||||
$this->posts_table = $container->get_parameter('tables.posts');
|
||||
|
||||
// Esto se cargara por servicio abajo
|
||||
$this->search_indexer = new fulltext_native(
|
||||
$this->config,
|
||||
$this->db,
|
||||
$this->phpbb_dispatcher,
|
||||
$container->get('language'),
|
||||
$this->user,
|
||||
$this->phpbb_root_path,
|
||||
$this->php_ext
|
||||
|
@ -148,7 +148,6 @@ class create_search_index extends database_task
|
|||
// Make sure fulltext native load update is set
|
||||
$this->config->set('fulltext_native_load_upd', 1);
|
||||
|
||||
// TODO: Replace this with create_index() when it don't depend on acp
|
||||
try
|
||||
{
|
||||
$sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id FROM ' . $this->posts_table;
|
||||
|
@ -181,7 +180,7 @@ class create_search_index extends database_task
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count() : int
|
||||
public static function get_step_count() : int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
namespace phpbb\search\backend;
|
||||
|
||||
use phpbb\cache\service;
|
||||
use phpbb\config\config;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
use phpbb\event\dispatcher_interface;
|
||||
|
@ -73,7 +72,6 @@ class fulltext_mysql extends base implements search_backend_interface
|
|||
* Constructor
|
||||
* Creates a new \phpbb\search\backend\fulltext_mysql, which is used as a search backend
|
||||
*
|
||||
* @param service $cache
|
||||
* @param config $config Config object
|
||||
* @param driver_interface $db Database object
|
||||
* @param dispatcher_interface $phpbb_dispatcher Event dispatcher object
|
||||
|
@ -82,8 +80,10 @@ class fulltext_mysql extends base implements search_backend_interface
|
|||
* @param string $phpbb_root_path Relative path to phpBB root
|
||||
* @param string $phpEx PHP file extension
|
||||
*/
|
||||
public function __construct(service $cache, config $config, driver_interface $db, dispatcher_interface $phpbb_dispatcher, language $language, user $user, string $phpbb_root_path, string $phpEx)
|
||||
public function __construct(config $config, driver_interface $db, dispatcher_interface $phpbb_dispatcher, language $language, user $user, string $phpbb_root_path, string $phpEx)
|
||||
{
|
||||
global $cache;
|
||||
|
||||
parent::__construct($cache, $config, $db, $user);
|
||||
$this->phpbb_dispatcher = $phpbb_dispatcher;
|
||||
$this->language = $language;
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
namespace phpbb\search\backend;
|
||||
|
||||
use phpbb\cache\service;
|
||||
use phpbb\config\config;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
use phpbb\event\dispatcher_interface;
|
||||
|
@ -102,7 +101,6 @@ class fulltext_native extends base implements search_backend_interface
|
|||
/**
|
||||
* Initialises the fulltext_native search backend with min/max word length
|
||||
*
|
||||
* @param service $cache
|
||||
* @param config $config Config object
|
||||
* @param driver_interface $db Database object
|
||||
* @param dispatcher_interface $phpbb_dispatcher Event dispatcher object
|
||||
|
@ -111,8 +109,10 @@ class fulltext_native extends base implements search_backend_interface
|
|||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param string $phpEx PHP file extension
|
||||
*/
|
||||
public function __construct(service $cache, config $config, driver_interface $db, dispatcher_interface $phpbb_dispatcher, language $language, user $user, string $phpbb_root_path, string $phpEx)
|
||||
public function __construct(config $config, driver_interface $db, dispatcher_interface $phpbb_dispatcher, language $language, user $user, string $phpbb_root_path, string $phpEx)
|
||||
{
|
||||
global $cache;
|
||||
|
||||
parent::__construct($cache, $config, $db, $user);
|
||||
$this->phpbb_dispatcher = $phpbb_dispatcher;
|
||||
$this->language = $language;
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
namespace phpbb\search\backend;
|
||||
|
||||
use phpbb\cache\service;
|
||||
use phpbb\config\config;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
use phpbb\event\dispatcher_interface;
|
||||
|
@ -85,7 +84,6 @@ class fulltext_postgres extends base implements search_backend_interface
|
|||
* Constructor
|
||||
* Creates a new \phpbb\search\backend\fulltext_postgres, which is used as a search backend
|
||||
*
|
||||
* @param service $cache
|
||||
* @param config $config Config object
|
||||
* @param driver_interface $db Database object
|
||||
* @param dispatcher_interface $phpbb_dispatcher Event dispatcher object
|
||||
|
@ -94,8 +92,10 @@ class fulltext_postgres extends base implements search_backend_interface
|
|||
* @param string $phpbb_root_path Relative path to phpBB root
|
||||
* @param string $phpEx PHP file extension
|
||||
*/
|
||||
public function __construct(service $cache, config $config, driver_interface $db, dispatcher_interface $phpbb_dispatcher, language $language, user $user, string $phpbb_root_path, string $phpEx)
|
||||
public function __construct(config $config, driver_interface $db, dispatcher_interface $phpbb_dispatcher, language $language, user $user, string $phpbb_root_path, string $phpEx)
|
||||
{
|
||||
global $cache;
|
||||
|
||||
parent::__construct($cache, $config, $db, $user);
|
||||
$this->phpbb_dispatcher = $phpbb_dispatcher;
|
||||
$this->language = $language;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
namespace phpbb\search\backend;
|
||||
|
||||
use phpbb\auth\auth;
|
||||
use phpbb\cache\service;
|
||||
use phpbb\config\config;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
use phpbb\db\tools\tools_interface;
|
||||
|
|
|
@ -40,6 +40,6 @@ class phpbb_search_mysql_test extends phpbb_search_common_test_case
|
|||
$this->db = $this->new_dbal();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$class = self::get_search_wrapper('\phpbb\search\backend\fulltext_mysql');
|
||||
$this->search = new $class($cache, $config, $this->db, $phpbb_dispatcher, $language, $user, $phpbb_root_path, $phpEx);
|
||||
$this->search = new $class($config, $this->db, $phpbb_dispatcher, $language, $user, $phpbb_root_path, $phpEx);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class phpbb_search_native_test extends phpbb_search_test_case
|
|||
$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($cache, $config, $this->db, $phpbb_dispatcher, $language, $user, $phpbb_root_path, $phpEx);
|
||||
$this->search = new $class($config, $this->db, $phpbb_dispatcher, $language, $user, $phpbb_root_path, $phpEx);
|
||||
}
|
||||
|
||||
public function keywords()
|
||||
|
|
|
@ -40,6 +40,6 @@ class phpbb_search_postgres_test extends phpbb_search_common_test_case
|
|||
$this->db = $this->new_dbal();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$class = self::get_search_wrapper('\phpbb\search\backend\fulltext_postgres');
|
||||
$this->search = new $class($cache, $config, $this->db, $phpbb_dispatcher, $language, $user, $phpbb_root_path, $phpEx);
|
||||
$this->search = new $class($config, $this->db, $phpbb_dispatcher, $language, $user, $phpbb_root_path, $phpEx);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue