aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional/search_test.php
blob: db3b63c23014121f67de6957764e5c69575582f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/**
 *
 * @package testing
 * @copyright (c) 2013 phpBB Group
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
 *
 */

/**
 * @group functional
 */
class phpbb_functional_search_test extends phpbb_functional_test_case
{

	public function test_native()
	{
		$this->search_backend_test('phpbb_search_fulltext_native');
	}

	public function test_mysql_fulltext()
	{
		$this->search_backend_test('phpbb_search_fulltext_mysql');

	}

	public function test_postgres_fulltext()
	{
		$this->search_backend_test('phpbb_search_fulltext_postgres');

	}

	public function test_sphinx()
	{
		$this->search_backend_test('phpbb_search_fulltext_sphinx');
	}

	public function search_found()
	{

	}

	public function search_not_found()
	{

	}

	protected function search_backend_test($search_backend)
	{
		$this->login();
		$this->admin_login();

		$crawler = self::request('GET', 'adm/index.php?i=acp_search&mode=settings&sid=' . $this->sid);
		$form = $crawler->selectButton('Submit')->form();
		$values = $form->getValues();

		if ($values["config[search_type]"] != $search_backend)
		{
			$values["config[search_type]"] = $search_backend;
			$form->setValues($values);
			$crawler = self::submit($form);

			$form = $crawler->selectButton('Yes')->form();
			$values = $form->getValues();
			$crawler = self::submit($form);

			file_put_contents('log' . $search_backend . '.html', $crawler->text());
		}

		$this->create_search_index($search_backend);
	}

	protected function create_search_index($search_backend)
	{

	}
}