diff options
author | Michael Hamann <michael@content-space.de> | 2013-01-06 11:25:37 -0800 |
---|---|---|
committer | Michael Hamann <michael@content-space.de> | 2013-01-06 11:25:37 -0800 |
commit | fdf855d93183bf3eb0074877172dab6809d9ef7d (patch) | |
tree | c81cd6190534c8a284baf6a2fea9738271cdb48a /_test | |
parent | b9ad156b06ca6d5530803836871777b10894f130 (diff) | |
parent | bff17c53db3caca2e08837dc163e10a15f82860b (diff) | |
download | rpg-fdf855d93183bf3eb0074877172dab6809d9ef7d.tar.gz rpg-fdf855d93183bf3eb0074877172dab6809d9ef7d.tar.bz2 |
Merge pull request #148 from michitux/indexer
Indexer: Add the PID to INDEXER_PAGE_ADD and add getPID/getPageFromPID functions
Diffstat (limited to '_test')
-rw-r--r-- | _test/core/DokuWikiTest.php | 2 | ||||
-rw-r--r-- | _test/tests/inc/indexer_pid.test.php | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/_test/core/DokuWikiTest.php b/_test/core/DokuWikiTest.php index b9e151456..91eb5293b 100644 --- a/_test/core/DokuWikiTest.php +++ b/_test/core/DokuWikiTest.php @@ -30,6 +30,8 @@ abstract class DokuWikiTest extends PHPUnit_Framework_TestCase { // remove any leftovers from the last run if(is_dir(DOKU_TMP_DATA)){ + // clear indexer data and cache + idx_get_indexer()->clear(); TestUtils::rdelete(DOKU_TMP_DATA); } diff --git a/_test/tests/inc/indexer_pid.test.php b/_test/tests/inc/indexer_pid.test.php new file mode 100644 index 000000000..8c58b1abd --- /dev/null +++ b/_test/tests/inc/indexer_pid.test.php @@ -0,0 +1,18 @@ +<?php +/** + * Tests the pid functions of the indexer. + * + * @author Michael Hamann <michael@content-space.de> + */ +class indexer_pid_test extends DokuWikiTest { + function test_pid() { + $indexer = idx_get_indexer(); + $syntaxPID = $indexer->getPID('wiki:syntax'); + $this->assertEquals('wiki:syntax', $indexer->getPageFromPID($syntaxPID), 'getPageFromPID(getPID(\'wiki:syntax\')) != \'wiki:syntax\''); + $dokuwikiPID = $indexer->getPID('wiki:dokuwiki'); + $this->assertEquals('wiki:syntax', $indexer->getPageFromPID($syntaxPID), 'getPageFromPID(getPID(\'wiki:syntax\')) != \'wiki:syntax\' after getting the PID for wiki:dokuwiki'); + $this->assertEquals($syntaxPID, $indexer->getPID('wiki:syntax'), 'getPID(\'wiki:syntax\') didn\'t returned different PIDs when called twice'); + $this->assertNotEquals($syntaxPID, $dokuwikiPID, 'Same PID returned for different pages'); + $this->assertTrue(is_numeric($syntaxPID) && is_numeric($dokuwikiPID), 'PIDs are not numeric'); + } +} |