[ticket/15540] Fix test

PHPBB3-15540
This commit is contained in:
rubencm 2021-03-23 04:35:32 +01:00
parent 656e57fbf6
commit cd8c09d0b3
10 changed files with 30 additions and 33 deletions

View file

@ -4,7 +4,6 @@ services:
search.fulltext.native: search.fulltext.native:
class: phpbb\search\backend\fulltext_native class: phpbb\search\backend\fulltext_native
arguments: arguments:
- '@cache'
- '@config' - '@config'
- '@dbal.conn' - '@dbal.conn'
- '@dispatcher' - '@dispatcher'
@ -18,7 +17,6 @@ services:
search.fulltext.mysql: search.fulltext.mysql:
class: phpbb\search\backend\fulltext_mysql class: phpbb\search\backend\fulltext_mysql
arguments: arguments:
- '@cache'
- '@config' - '@config'
- '@dbal.conn' - '@dbal.conn'
- '@dispatcher' - '@dispatcher'
@ -32,7 +30,6 @@ services:
search.fulltext.postgres: search.fulltext.postgres:
class: phpbb\search\backend\fulltext_postgres class: phpbb\search\backend\fulltext_postgres
arguments: arguments:
- '@cache'
- '@config' - '@config'
- '@dbal.conn' - '@dbal.conn'
- '@dispatcher' - '@dispatcher'

View file

@ -13,6 +13,8 @@
namespace phpbb\cache; namespace phpbb\cache;
use phpbb\cache\driver\driver_interface;
use phpbb\config\config;
use phpbb\json\sanitizer as json_sanitizer; use phpbb\json\sanitizer as json_sanitizer;
/** /**
@ -23,14 +25,14 @@ class service
/** /**
* Cache driver. * Cache driver.
* *
* @var \phpbb\cache\driver\driver_interface * @var driver_interface
*/ */
protected $driver; protected $driver;
/** /**
* The config. * The config.
* *
* @var \phpbb\config\config * @var config
*/ */
protected $config; protected $config;
@ -58,13 +60,13 @@ class service
/** /**
* Creates a cache service around a cache driver * Creates a cache service around a cache driver
* *
* @param \phpbb\cache\driver\driver_interface $driver The cache driver * @param driver_interface $driver The cache driver
* @param \phpbb\config\config $config The config * @param config $config The config
* @param \phpbb\db\driver\driver_interface $db Database connection * @param \phpbb\db\driver\driver_interface $db Database connection
* @param string $phpbb_root_path Root path * @param string $phpbb_root_path Root path
* @param string $php_ext PHP file extension * @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->set_driver($driver);
$this->config = $config; $this->config = $config;
@ -76,7 +78,7 @@ class service
/** /**
* Returns the cache driver used by this cache 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() public function get_driver()
{ {
@ -86,9 +88,9 @@ class service
/** /**
* Replaces the cache driver used by this cache 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; $this->driver = $driver;
} }

View file

@ -98,12 +98,12 @@ class create_search_index extends database_task
/** /**
* Constructor * Constructor
* *
* @param config $config Installer config. * @param config $config Installer config.
* @param database $db_helper Database helper. * @param database $db_helper Database helper.
* @param container_factory $container Installer's DI container * @param container_factory $container Installer's DI container
* @param iohandler_interface $iohandler IO manager. * @param iohandler_interface $iohandler IO manager.
* @param string $phpbb_root_path phpBB root path * @param string $phpbb_root_path phpBB root path
* @param string $php_ext PHP file extension * @param string $php_ext PHP file extension
*/ */
public function __construct( public function __construct(
config $config, config $config,
@ -127,11 +127,11 @@ class create_search_index extends database_task
$this->posts_table = $container->get_parameter('tables.posts'); $this->posts_table = $container->get_parameter('tables.posts');
// Esto se cargara por servicio abajo
$this->search_indexer = new fulltext_native( $this->search_indexer = new fulltext_native(
$this->config, $this->config,
$this->db, $this->db,
$this->phpbb_dispatcher, $this->phpbb_dispatcher,
$container->get('language'),
$this->user, $this->user,
$this->phpbb_root_path, $this->phpbb_root_path,
$this->php_ext $this->php_ext
@ -148,7 +148,6 @@ class create_search_index extends database_task
// Make sure fulltext native load update is set // Make sure fulltext native load update is set
$this->config->set('fulltext_native_load_upd', 1); $this->config->set('fulltext_native_load_upd', 1);
// TODO: Replace this with create_index() when it don't depend on acp
try try
{ {
$sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id FROM ' . $this->posts_table; $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} * {@inheritdoc}
*/ */
static public function get_step_count() : int public static function get_step_count() : int
{ {
return 1; return 1;
} }

View file

@ -13,7 +13,6 @@
namespace phpbb\search\backend; namespace phpbb\search\backend;
use phpbb\cache\service;
use phpbb\config\config; use phpbb\config\config;
use phpbb\db\driver\driver_interface; use phpbb\db\driver\driver_interface;
use phpbb\event\dispatcher_interface; use phpbb\event\dispatcher_interface;
@ -73,7 +72,6 @@ class fulltext_mysql extends base implements search_backend_interface
* Constructor * Constructor
* Creates a new \phpbb\search\backend\fulltext_mysql, which is used as a search backend * Creates a new \phpbb\search\backend\fulltext_mysql, which is used as a search backend
* *
* @param service $cache
* @param config $config Config object * @param config $config Config object
* @param driver_interface $db Database object * @param driver_interface $db Database object
* @param dispatcher_interface $phpbb_dispatcher Event dispatcher 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 $phpbb_root_path Relative path to phpBB root
* @param string $phpEx PHP file extension * @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); parent::__construct($cache, $config, $db, $user);
$this->phpbb_dispatcher = $phpbb_dispatcher; $this->phpbb_dispatcher = $phpbb_dispatcher;
$this->language = $language; $this->language = $language;

View file

@ -13,7 +13,6 @@
namespace phpbb\search\backend; namespace phpbb\search\backend;
use phpbb\cache\service;
use phpbb\config\config; use phpbb\config\config;
use phpbb\db\driver\driver_interface; use phpbb\db\driver\driver_interface;
use phpbb\event\dispatcher_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 * Initialises the fulltext_native search backend with min/max word length
* *
* @param service $cache
* @param config $config Config object * @param config $config Config object
* @param driver_interface $db Database object * @param driver_interface $db Database object
* @param dispatcher_interface $phpbb_dispatcher Event dispatcher 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 $phpbb_root_path phpBB root path
* @param string $phpEx PHP file extension * @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); parent::__construct($cache, $config, $db, $user);
$this->phpbb_dispatcher = $phpbb_dispatcher; $this->phpbb_dispatcher = $phpbb_dispatcher;
$this->language = $language; $this->language = $language;

View file

@ -13,7 +13,6 @@
namespace phpbb\search\backend; namespace phpbb\search\backend;
use phpbb\cache\service;
use phpbb\config\config; use phpbb\config\config;
use phpbb\db\driver\driver_interface; use phpbb\db\driver\driver_interface;
use phpbb\event\dispatcher_interface; use phpbb\event\dispatcher_interface;
@ -85,7 +84,6 @@ class fulltext_postgres extends base implements search_backend_interface
* Constructor * Constructor
* Creates a new \phpbb\search\backend\fulltext_postgres, which is used as a search backend * Creates a new \phpbb\search\backend\fulltext_postgres, which is used as a search backend
* *
* @param service $cache
* @param config $config Config object * @param config $config Config object
* @param driver_interface $db Database object * @param driver_interface $db Database object
* @param dispatcher_interface $phpbb_dispatcher Event dispatcher 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 $phpbb_root_path Relative path to phpBB root
* @param string $phpEx PHP file extension * @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); parent::__construct($cache, $config, $db, $user);
$this->phpbb_dispatcher = $phpbb_dispatcher; $this->phpbb_dispatcher = $phpbb_dispatcher;
$this->language = $language; $this->language = $language;

View file

@ -14,7 +14,6 @@
namespace phpbb\search\backend; namespace phpbb\search\backend;
use phpbb\auth\auth; use phpbb\auth\auth;
use phpbb\cache\service;
use phpbb\config\config; use phpbb\config\config;
use phpbb\db\driver\driver_interface; use phpbb\db\driver\driver_interface;
use phpbb\db\tools\tools_interface; use phpbb\db\tools\tools_interface;

View file

@ -40,6 +40,6 @@ class phpbb_search_mysql_test extends phpbb_search_common_test_case
$this->db = $this->new_dbal(); $this->db = $this->new_dbal();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$class = self::get_search_wrapper('\phpbb\search\backend\fulltext_mysql'); $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);
} }
} }

View file

@ -38,7 +38,7 @@ class phpbb_search_native_test extends phpbb_search_test_case
$class = self::get_search_wrapper('\phpbb\search\backend\fulltext_native'); $class = self::get_search_wrapper('\phpbb\search\backend\fulltext_native');
$config['fulltext_native_min_chars'] = 2; $config['fulltext_native_min_chars'] = 2;
$config['fulltext_native_max_chars'] = 14; $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() public function keywords()

View file

@ -40,6 +40,6 @@ class phpbb_search_postgres_test extends phpbb_search_common_test_case
$this->db = $this->new_dbal(); $this->db = $this->new_dbal();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$class = self::get_search_wrapper('\phpbb\search\backend\fulltext_postgres'); $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);
} }
} }