1<?php 2 3/** 4 * Test the indextitleonly plugin 5 * 6 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 7 * @author Michael Hamann <michael@content-space.de> 8 */ 9class plugin_indextitleonly_test extends DokuWikiTest { 10 public function setup() { 11 global $conf; 12 $this->pluginsEnabled[] = 'indextitleonly'; 13 parent::setup(); 14 15 $conf['plugin']['indextitleonly']['namespace'] = 'titleonly'; 16 17 saveWikiText('titleonly:sub:test', "====== Title ====== \n content", 'created'); 18 saveWikiText('test', "====== Title ====== \n content", 'created'); 19 idx_addPage('titleonly:sub:test'); 20 idx_addPage('test'); 21 } 22 23 public function test_title_returns_both() { 24 $query = array('title'); 25 $this->assertEquals(array('title' => array('test' => 1, 'titleonly:sub:test' => 1)), idx_get_indexer()->lookup($query)); 26 } 27 28 public function test_content_doesnt_return_excluded() { 29 $query = array('content'); 30 $this->assertEquals(array('content' => array('test' => 1)), idx_get_indexer()->lookup($query)); 31 } 32} 33