1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-15 20:17:36 +02:00

[ticket/11608] rename search_found and not_found method

Rename search_found and search_not_found to assert_search_found and
assert_search_not_found. Count .errorbox incase the search backend is not
supported and skip tests

PHPBB3-11608
This commit is contained in:
Dhruv 2013-07-06 14:38:42 +05:30
parent b7d55b8ff8
commit 07c259f4b1

View File

@ -12,15 +12,14 @@
*/ */
abstract class phpbb_functional_search_test extends phpbb_functional_test_case abstract class phpbb_functional_search_test extends phpbb_functional_test_case
{ {
protected function assert_search_found($keywords)
protected function search_found($keywords)
{ {
$crawler = self::request('GET', 'search.php?keywords=' . $keywords); $crawler = self::request('GET', 'search.php?keywords=' . $keywords);
$this->assertEquals(1, $crawler->filter('.postbody')->count()); $this->assertEquals(1, $crawler->filter('.postbody')->count());
$this->assertEquals(3, $crawler->filter('.posthilit')->count()); $this->assertEquals(3, $crawler->filter('.posthilit')->count());
} }
protected function search_not_found($keywords) protected function assert_search_not_found($keywords)
{ {
$crawler = self::request('GET', 'search.php?keywords=' . $keywords); $crawler = self::request('GET', 'search.php?keywords=' . $keywords);
$this->assertEquals(0, $crawler->filter('.postbody')->count()); $this->assertEquals(0, $crawler->filter('.postbody')->count());
@ -47,19 +46,18 @@ abstract class phpbb_functional_search_test extends phpbb_functional_test_case
$values = $form->getValues(); $values = $form->getValues();
$crawler = self::submit($form); $crawler = self::submit($form);
try // check if search backend is not supported
if ($crawler->filter('.errorbox')->count() > 0);
{ {
$crawler->filter('.errorbox')->text();
$this->markTestSkipped("Search backend is not supported/running"); $this->markTestSkipped("Search backend is not supported/running");
} }
catch (InvalidArgumentException $e) {}
$this->create_search_index(); $this->create_search_index();
} }
$this->logout(); $this->logout();
$this->search_found('phpbb3+installation'); $this->assert_search_found('phpbb3+installation');
$this->search_not_found('loremipsumdedo'); $this->assert_search_not_found('loremipsumdedo');
$this->login(); $this->login();
$this->admin_login(); $this->admin_login();