getDbh(); $subpages = $dbi->titleSearch($query, $sortby, $limit, $exclude); $result = array(); while ($page = $subpages->next()) $result[] = $page->getName(); $this->assertTrue(count($result) > 0, "glob count > 0"); // apply limit $sortby = false; $limit = 5; $exclude = ""; $subpages = $dbi->titleSearch($query, $sortby, $limit, $exclude); // don't trust count() with limit $this->assertTrue($subpages->count() > 0 and $subpages->count() <= 7, "0 < count() <= 7"); $result = array(); // but the iterator should limit while ($page = $subpages->next()) $result[] = $page->getName(); $this->assertEquals(5, count($result), "limit 5"); } function testFulltextSearch() { global $request; $dbi = $request->getDbh(); $query = new TextSearchQuery('Indent the paragraph*', true); // auto $pages = $dbi->fullSearch($query); $result = array(); while ($page = $pages->next()) $result[] = $page->getName(); $this->assertTrue(in_array("TextFormattingRules", $result), "found all"); $query = new TextSearchQuery('"Indent the paragraph"', false); // case-insensitive, auto $pages = $dbi->fullSearch($query); $result = array(); while ($page = $pages->next()) $result[] = $page->getName(); $this->assertTrue(in_array("TextFormattingRules", $result), "found phrase"); } } ?>