diff options
author | Andreas Gohr <andi@splitbrain.org> | 2013-01-23 00:18:57 -0800 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2013-01-23 00:18:57 -0800 |
commit | fb83d19fe0215e7fa5e71a1ab713342e8f84d9d1 (patch) | |
tree | e151a4a971a558359301b02fcb6203209874e684 /_test | |
parent | e38f3066cedb80722b3488e7ab3b2809b6db5363 (diff) | |
parent | 05074c7596bd0f90791cb40cf23c9852a777f561 (diff) | |
download | rpg-fb83d19fe0215e7fa5e71a1ab713342e8f84d9d1.tar.gz rpg-fb83d19fe0215e7fa5e71a1ab713342e8f84d9d1.tar.bz2 |
Merge pull request #160 from gturri/addedUTests
Added unit tests
Diffstat (limited to '_test')
-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')); |