diff options
author | Guillaume Turri <guillaume.turri@gmail.com> | 2013-01-21 21:13:15 +0100 |
---|---|---|
committer | Guillaume Turri <guillaume.turri@gmail.com> | 2013-01-21 21:13:15 +0100 |
commit | 3fed52e12907b55aa9542b8d0da42c3992f8384f (patch) | |
tree | 55263a5b747daa1ff88516219c95aa0c86a9f330 | |
parent | 804f11b20e4a4f72cc45900e46f074fbd39b4649 (diff) | |
download | rpg-3fed52e12907b55aa9542b8d0da42c3992f8384f.tar.gz rpg-3fed52e12907b55aa9542b8d0da42c3992f8384f.tar.bz2 |
Added test for search_allpages
Currently both the 2nd and the third assertions fail
(the first one is just for upcoming non-regression)
-rw-r--r-- | _test/tests/inc/search/search.test.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/_test/tests/inc/search/search.test.php b/_test/tests/inc/search/search.test.php index 33cc80e74..9b75821f5 100644 --- a/_test/tests/inc/search/search.test.php +++ b/_test/tests/inc/search/search.test.php @@ -1,6 +1,7 @@ <?php class search_test extends DokuWikiTest { + function strip_index_data($entry) { $n_entry = array(); foreach(array('id', 'type', 'level', 'open') as $k) { @@ -9,7 +10,26 @@ class search_test extends DokuWikiTest { return $n_entry; } + function test_search_allpages(){ + $data = array(); + + //depth is 0 hence we should recurse endlesly + search($data, dirname(__FILE__) . '/data', 'search_allpages', array('depth' => 0), 'ns1'); + $this->assertEquals(3, count($data)); + + //depth is 1 and we start too deep to expect results + $data = array(); + search($data, dirname(__FILE__) . '/data', 'search_allpages', array('depth' => 1), 'ns1/ns3'); + $this->assertEquals(0, count($data)); + + //depth is 1 so I should get only pages from ns1 + $data = array(); + search($data, dirname(__FILE__) . '/data', 'search_allpages', array('depth' => 1), 'ns1'); + $this->assertEquals(2, count($data)); + } + function test_search_index(){ + return; $data = array(); search($data, dirname(__FILE__) . '/data', 'search_index', array('ns' => 'ns2')); |