diff options
author | Dhruv <dhruv.goel92@gmail.com> | 2013-06-19 02:13:32 +0530 |
---|---|---|
committer | Dhruv <dhruv.goel92@gmail.com> | 2013-10-05 21:15:29 +0530 |
commit | 36da38f062477e48ddc13cde683515ec9f5921f3 (patch) | |
tree | 7924896bb43895b0c3563140f3362dcd7d45b2e0 | |
parent | 9c082999bb1761c95b58d2d6baa3e03ed16f58c9 (diff) | |
download | forums-36da38f062477e48ddc13cde683515ec9f5921f3.tar forums-36da38f062477e48ddc13cde683515ec9f5921f3.tar.gz forums-36da38f062477e48ddc13cde683515ec9f5921f3.tar.bz2 forums-36da38f062477e48ddc13cde683515ec9f5921f3.tar.xz forums-36da38f062477e48ddc13cde683515ec9f5921f3.zip |
[ticket/11608] split search tests into separate files
Tests for each search backend are into their own separate files.
These separate classes inherit from a common search test case class.
PHPBB3-11608
-rw-r--r-- | tests/functional/search_mysql_test.php | 24 | ||||
-rw-r--r-- | tests/functional/search_native_test.php | 24 | ||||
-rw-r--r-- | tests/functional/search_postgres_test.php | 24 | ||||
-rw-r--r-- | tests/functional/search_sphinx_test.php | 25 | ||||
-rw-r--r-- | tests/functional/search_test.php | 48 |
5 files changed, 109 insertions, 36 deletions
diff --git a/tests/functional/search_mysql_test.php b/tests/functional/search_mysql_test.php new file mode 100644 index 0000000000..b55d0c808c --- /dev/null +++ b/tests/functional/search_mysql_test.php @@ -0,0 +1,24 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/search_test.php'; + +/** +* @group functional +*/ +class phpbb_functional_search_mysql_test extends phpbb_functional_search_test +{ + protected $search_backend; + + public function setUp() + { + parent::setUp(); + $this->search_backend = 'phpbb_search_fulltext_mysql'; + } +} diff --git a/tests/functional/search_native_test.php b/tests/functional/search_native_test.php new file mode 100644 index 0000000000..9bcdc01547 --- /dev/null +++ b/tests/functional/search_native_test.php @@ -0,0 +1,24 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/search_test.php'; + +/** +* @group functional +*/ +class phpbb_functional_search_native_test extends phpbb_functional_search_test +{ + protected $search_backend; + + public function setUp() + { + parent::setUp(); + $this->search_backend = 'phpbb_search_fulltext_native'; + } +} diff --git a/tests/functional/search_postgres_test.php b/tests/functional/search_postgres_test.php new file mode 100644 index 0000000000..5b46db5c82 --- /dev/null +++ b/tests/functional/search_postgres_test.php @@ -0,0 +1,24 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/search_test.php'; + +/** +* @group functional +*/ +class phpbb_functional_search_postgres_test extends phpbb_functional_search_test +{ + protected $search_backend; + + public function setUp() + { + parent::setUp(); + $this->search_backend = 'phpbb_search_fulltext_postgres'; + } +} diff --git a/tests/functional/search_sphinx_test.php b/tests/functional/search_sphinx_test.php new file mode 100644 index 0000000000..c70ea04715 --- /dev/null +++ b/tests/functional/search_sphinx_test.php @@ -0,0 +1,25 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/search_test.php'; + +/** +* @group functional +*/ +class phpbb_functional_search_sphinx_test extends phpbb_functional_search_test +{ + protected $search_backend; + + public function setUp() + { + parent::setUp(); + $this->search_backend = 'phpbb_search_fulltext_sphinx'; + $this->markTestIncomplete('Sphinx search not running for the test board'); + } +} diff --git a/tests/functional/search_test.php b/tests/functional/search_test.php index c18aa421be..f7c9e949b6 100644 --- a/tests/functional/search_test.php +++ b/tests/functional/search_test.php @@ -10,46 +10,23 @@ /** * @group functional */ -class phpbb_functional_search_test extends phpbb_functional_test_case +abstract 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->markTestIncomplete('Sphinx search not running for the test board'); - $this->search_backend_test('phpbb_search_fulltext_sphinx'); - } - - public function search_found() + protected function search_found() { $crawler = self::request('GET', 'search.php?keywords=phpbb3+installation'); $this->assertGreaterThan(0, $crawler->filter('.postbody')->count()); $this->assertEquals(3, $crawler->filter('.posthilit')->count()); } - public function search_not_found() + protected function search_not_found() { $crawler = self::request('GET', 'search.php?keywords=loremipsumdedo'); $this->assertLessThan(1, $crawler->filter('.postbody')->count()); } - protected function search_backend_test($search_backend) + public function test_search_backend() { $this->login(); $this->admin_login(); @@ -58,9 +35,9 @@ class phpbb_functional_search_test extends phpbb_functional_test_case $form = $crawler->selectButton('Submit')->form(); $values = $form->getValues(); - if ($values["config[search_type]"] != $search_backend) + if ($values["config[search_type]"] != $this->search_backend) { - $values["config[search_type]"] = $search_backend; + $values["config[search_type]"] = $this->search_backend; $form->setValues($values); $crawler = self::submit($form); @@ -72,11 +49,10 @@ class phpbb_functional_search_test extends phpbb_functional_test_case { $crawler->filter('.errorbox')->text(); self::markTestSkipped("Search backend is not supported/running"); - } catch (InvalidArgumentException $e) {} - $this->create_search_index($search_backend); + $this->create_search_index(); } $this->logout(); @@ -85,17 +61,17 @@ class phpbb_functional_search_test extends phpbb_functional_test_case $this->login(); $this->admin_login(); - $this->delete_search_index($search_backend); + $this->delete_search_index(); } - protected function create_search_index($search_backend) + protected function create_search_index() { $this->add_lang('acp/search'); $crawler = self::request( 'POST', 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid, array( - 'search_type' => $search_backend, + 'search_type' => $this->search_backend, 'action' => 'create', 'submit' => true, ) @@ -103,14 +79,14 @@ class phpbb_functional_search_test extends phpbb_functional_test_case $this->assertContains($this->lang('SEARCH_INDEX_CREATED'), $crawler->text()); } - protected function delete_search_index($search_backend) + protected function delete_search_index() { $this->add_lang('acp/search'); $crawler = self::request( 'POST', 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid, array( - 'search_type' => $search_backend, + 'search_type' => $this->search_backend, 'action' => 'delete', 'submit' => true, ) |