-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add index for media usage (will be used for media moves later)
- Loading branch information
Showing
2 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/** | ||
* Test cases for the media usage index | ||
* | ||
* @author Michael Hamann <[email protected]> | ||
*/ | ||
class plugin_pagemove_mediaindex_test extends DokuWikiTest { | ||
|
||
public function setUp() { | ||
$this->pluginsEnabled[] = 'pagemove'; | ||
parent::setUp(); | ||
} | ||
|
||
public function test_internalmedia() { | ||
saveWikiText('test:internalmedia_usage', '{{internalmedia.png}} {{..:internal media.png}}', 'Test initialization'); | ||
idx_addPage('test:internalmedia_usage'); | ||
|
||
$query = array('test:internalmedia.png', 'internal_media.png'); | ||
$this->assertEquals( array( | ||
'test:internalmedia.png' => array('test:internalmedia_usage'), | ||
'internal_media.png' => array('test:internalmedia_usage') | ||
), idx_get_indexer()->lookupKey('pagemove_media', $query)); | ||
} | ||
|
||
public function test_media_in_links() { | ||
saveWikiText('test:medialinks', '[[doku>wiki:dokuwiki|{{wiki:logo.png}}]] [[http://www.example.com|{{example.png?200x800}}]]', 'Test init'); | ||
idx_addPage('test:medialinks'); | ||
|
||
$query = array('wiki:logo.png', 'test:example.png'); | ||
$this->assertEquals(array( | ||
'wiki:logo.png' => array('test:medialinks'), | ||
'test:example.png' => array('test:medialinks') | ||
), idx_get_indexer()->lookupKey('pagemove_media', $query)); | ||
} | ||
|
||
public function test_media_in_footnotes() { | ||
saveWikiText('test:media_footnotes', '(({{footnote.png?20x50}} [[foonote|{{:footlink.png}}]]))', 'Test initialization'); | ||
idx_addPage('test:media_footnotes'); | ||
|
||
$query = array('test:footnote.png', 'footlink.png'); | ||
$this->assertEquals(array( | ||
'test:footnote.png' => array('test:media_footnotes'), | ||
'footlink.png' => array('test:media_footnotes') | ||
), idx_get_indexer()->lookupKey('pagemove_media', $query)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters