Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
phpbb_functional_search_sphinx_test
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 2
30
0.00% covered (danger)
0.00%
0 / 1
 setUp
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
 create_search_index
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14require_once __DIR__ . '/base.php';
15
16/**
17* @group functional
18*/
19class phpbb_functional_search_sphinx_test extends phpbb_functional_search_base
20{
21    protected $search_backend = 'phpbb\search\backend\fulltext_sphinx';
22
23    protected function setUp(): void
24    {
25        $sql_layer = substr(self::$config['dbms'], strlen('phpbb\\db\\driver\\'));
26        if ($sql_layer !== 'mysqli') // Sphinx search backend runs on MySQL/MariaDB only so far
27        {
28            $this->markTestSkipped($sql_layer . ': Sphinx search is not supported');
29        }
30
31        parent::setUp();
32    }
33
34    protected function create_search_index($backend = null)
35    {
36        parent::create_search_index($backend);
37        $this->purge_cache();
38
39        if (!$backend || $this->search_backend == $backend)
40        {
41            $output = $retval = null;
42
43            // After creating phpBB search index, build Sphinx index
44            exec('sudo -S service sphinxsearch stop', $output, $retval); // Attempt to stop sphinxsearch service in case it's running
45            exec('sudo -S indexer --all', $output, $retval); // Run sphinxsearch indexer
46            exec('sudo -S service sphinxsearch start', $output, $retval); // Attempt to start sphinxsearch service again
47        }
48    }
49}