[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 namespace dokuwiki\test\Feed; 4 5 use dokuwiki\Feed\FeedMediaProcessor; 6 use DOMWrap\Document; 7 8 class FeedMediaProcessorTest extends \DokuWikiTest 9 { 10 11 public function provideData() 12 { 13 // an Item returned by FeedCreator::fetchItemsFromRecentChanges() 14 yield ([ 15 array( 16 'date' => 1705511543, 17 'ip' => '::1', 18 'type' => 'C', 19 'id' => 'wiki:dokuwiki-128.png', 20 'user' => 'testuser', 21 'sum' => 'created', 22 'extra' => '', 23 'sizechange' => 52618, 24 'perms' => 8, 25 'mode' => 'media', 26 ), 27 1705511543, // fixed revision 28 ['testuser@undisclosed.example.com', 'Arthur Dent'], // proper author 29 'created', // summary 30 ]); 31 32 // FeedCreator::fetchItemsFromNamespace() currently does not support media files 33 // FeedCreator::fetchItemsFromSearch() currently does not support media files 34 } 35 36 37 /** 38 * @dataProvider provideData 39 */ 40 public function testProcessing($data, $expectedMtime, $expectedAuthor, $expectedSummary) 41 { 42 global $conf; 43 $conf['useacl'] = 1; 44 $conf['showuseras'] = 'username'; 45 $conf['useheading'] = 1; 46 47 $proc = new FeedMediaProcessor($data); 48 49 $this->assertEquals('wiki:dokuwiki-128.png', $proc->getId()); 50 $this->assertEquals('dokuwiki-128.png', $proc->getTitle()); 51 $this->assertEquals($expectedAuthor, $proc->getAuthor()); 52 $this->assertEquals($expectedMtime, $proc->getRev()); 53 $this->assertEquals(null, $proc->getPrev()); 54 $this->assertTrue($proc->isExisting()); 55 $this->assertTrue($proc->isExisting()); 56 $this->assertEquals(['wiki'], $proc->getCategory()); 57 $this->assertEquals($expectedSummary, $proc->getSummary()); 58 59 $this->assertEquals( 60 "http://wiki.example.com/doku.php?image=wiki%3Adokuwiki-128.png&ns=wiki&rev=$expectedMtime&do=media", 61 $proc->getURL('page') 62 ); 63 $this->assertEquals( 64 "http://wiki.example.com/doku.php?image=wiki%3Adokuwiki-128.png&ns=wiki&rev=$expectedMtime&tab_details=history&do=media", 65 $proc->getURL('rev') 66 ); 67 $this->assertEquals( 68 "http://wiki.example.com/doku.php?image=wiki%3Adokuwiki-128.png&ns=wiki&do=media", 69 $proc->getURL('current') 70 ); 71 $this->assertEquals( 72 "http://wiki.example.com/doku.php?image=wiki%3Adokuwiki-128.png&ns=wiki&rev=$expectedMtime&tab_details=history&media_do=diff&do=media", 73 $proc->getURL('diff') 74 ); 75 76 77 $doc = new Document(); 78 $doc->html($proc->getBody('diff')); 79 $th = $doc->find('table th'); 80 $this->assertGreaterThanOrEqual(2, $th->count()); 81 82 $doc = new Document(); 83 $doc->html($proc->getBody('htmldiff')); 84 $th = $doc->find('table th'); 85 $this->assertGreaterThanOrEqual(2, $th->count()); 86 87 $doc = new Document(); 88 $doc->html($proc->getBody('html')); 89 $home = $doc->find('img'); 90 $this->assertEquals(1, $home->count()); 91 } 92 93 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body