Index: trunk/extensions/ArchiveLinks/ArchiveLinksTests.php |
— | — | @@ -0,0 +1,32 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class ArchiveLinksTests extends PHPUnit_Framework_TestCase { |
| 5 | + public function testLinksRewrittenCorrectly( ) { |
| 6 | + global $wgArchiveLinksConfig; |
| 7 | + |
| 8 | + ArchiveLinks::rewriteLinks( 'http://test.com', 'test.com', &$rewritten_link, array( 'rel' => 'nofollow', 'class' => 'external free' ) ); |
| 9 | + |
| 10 | + switch ( $wgArchiveLinksConfig['archive_service'] ) { |
| 11 | + case 'local': |
| 12 | + //spider is not fully implmented, until it is we can't test this |
| 13 | + break; |
| 14 | + case 'wikiwix': |
| 15 | + $this->assertEquals( '<a rel="nofollow" class="external free" href="http://test.com">http://test.com</a><sup><small> ' . |
| 16 | + '<a rel="nofollow" href="http://archive.wikiwix.com/cache/?url=http://test.com">[cache]</a></small></sup>', |
| 17 | + $rewritten_link ); |
| 18 | + break; |
| 19 | + case 'webcitation': |
| 20 | + $this->assertEquals( '<a rel="nofollow" class="external free" href="http://test.com">http://test.com</a><sup><small> ' . |
| 21 | + '<a rel="nofollow" href="http://webcitation.org/query?url=http://test.com">[cache]</a></small></sup>', |
| 22 | + $rewritten_link ); |
| 23 | + break; |
| 24 | + case 'internet_archive': |
| 25 | + default: |
| 26 | + $this->assertEquals( 'http://wayback.archive.org/web/*/test.com', |
| 27 | + $rewritten_link ); |
| 28 | + break; |
| 29 | + } |
| 30 | + |
| 31 | + //$this->assertRegex( '%%', $rewritten_link ); |
| 32 | + } |
| 33 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/ArchiveLinks/ArchiveLinksTests.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 34 | + native |
Index: trunk/extensions/ArchiveLinks/spider.php |
— | — | @@ -312,8 +312,7 @@ |
313 | 313 | * @return array |
314 | 314 | */ |
315 | 315 | private function parse_wget_log( $log_path, $url ) { |
316 | | - //We have a die statement here, PHP error unnecessary |
317 | | - @$fp = fopen( $log_path, 'r' ) or die( 'can\'t find wget log file to parse' ); |
| 316 | + $fp = fopen( $log_path, 'r' ) or die( 'can\'t find wget log file to parse' ); |
318 | 317 | |
319 | 318 | $this->downloaded_files = array ( ); |
320 | 319 | |