mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-30 19:49:54 +02:00
[ticket/12683] Code review
PHPBB3-12683
This commit is contained in:
85
tests/console/searchindex/phpbb_console_searchindex_base.php
Normal file
85
tests/console/searchindex/phpbb_console_searchindex_base.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
use phpbb\config\config;
|
||||
use phpbb\di\service_collection;
|
||||
use phpbb\language\language;
|
||||
use phpbb\log\log;
|
||||
use phpbb\posting\post_helper;
|
||||
use phpbb\search\search_backend_factory;
|
||||
use phpbb\search\state_helper;
|
||||
use phpbb\user;
|
||||
|
||||
require_once __DIR__ . '/../../mock/search_backend_mock.php';
|
||||
|
||||
class phpbb_console_searchindex_base extends phpbb_test_case
|
||||
{
|
||||
/** @var config */
|
||||
protected $config;
|
||||
|
||||
/** @var language */
|
||||
protected $language;
|
||||
|
||||
/** @var log */
|
||||
protected $log;
|
||||
|
||||
/** @var post_helper */
|
||||
protected $post_helper;
|
||||
|
||||
/** @var user */
|
||||
protected $user;
|
||||
|
||||
/** @var search_backend_factory */
|
||||
protected $search_backend_factory;
|
||||
|
||||
/** @var state_helper */
|
||||
protected $state_helper;
|
||||
|
||||
/** @var service_collection */
|
||||
protected $search_backend_collection;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
$this->config = new \phpbb\config\config([
|
||||
'search_indexing_state' => [],
|
||||
'search_type' => 'search_backend_mock'
|
||||
]);
|
||||
|
||||
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
|
||||
$this->language = new \phpbb\language\language($lang_loader);
|
||||
|
||||
$this->log = $this->createMock('\phpbb\log\log');
|
||||
|
||||
$this->post_helper = $this->createMock('\phpbb\posting\post_helper');
|
||||
$this->post_helper
|
||||
->method('get_max_post_id')
|
||||
->willReturn(1000);
|
||||
|
||||
$this->user = $this->createMock('\phpbb\user');
|
||||
|
||||
$phpbb_container = new phpbb_mock_container_builder();
|
||||
$search_backend_mock = new search_backend_mock();
|
||||
$this->search_backend_collection = new \phpbb\di\service_collection($phpbb_container);
|
||||
$this->search_backend_collection->add('search_backend_mock');
|
||||
$this->search_backend_collection->add_service_class('search_backend_mock', 'search_backend_mock');
|
||||
$phpbb_container->set('search_backend_mock', $search_backend_mock);
|
||||
|
||||
$this->search_backend_factory = new search_backend_factory($this->config, $this->search_backend_collection);
|
||||
|
||||
$this->state_helper = new state_helper($this->config, $this->search_backend_factory);
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user