Index: trunk/extensions/CodeReview/CodeReview.php |
— | — | @@ -177,3 +177,10 @@ |
178 | 178 | return true; |
179 | 179 | } |
180 | 180 | |
| 181 | +# Unit tests |
| 182 | +$wgHooks['UnitTestsList'][] = 'efCodeReviewUnitTests'; |
| 183 | + |
| 184 | +function efCodeReviewUnitTests( &$files ) { |
| 185 | + $files[] = dirname( __FILE__ ) . '/tests/CodeReviewTest.php'; |
| 186 | + return true; |
| 187 | +} |
Index: trunk/extensions/CodeReview/tests/CodeReviewTest.php |
— | — | @@ -0,0 +1,26 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class CodeReviewTest extends PHPUnit_Framework_TestCase { |
| 5 | + private function createRepo() { |
| 6 | + $row = new stdClass(); |
| 7 | + $row->repo_id = 1; |
| 8 | + $row->repo_name = 'Test'; |
| 9 | + $row->repo_path = 'somewhere'; |
| 10 | + $row->repo_viewvc = 'http://example.com/view/'; |
| 11 | + $row->repo_bugzilla = 'http://example.com/bugzilla/$1'; |
| 12 | + |
| 13 | + return CodeRepository::newFromRow( $row ); |
| 14 | + } |
| 15 | + |
| 16 | + public function testCommentWikiFormatting() { |
| 17 | + $repo = $this->createRepo(); |
| 18 | + $formatter = new CodeCommentLinkerWiki( $repo ); |
| 19 | + |
| 20 | + $this->assertEquals( '[http://foo http://foo]', $formatter->link( 'http://foo' ) ); |
| 21 | + $this->assertEquals( '[http://example.com/bugzilla/123 bug 123]', $formatter->link( 'bug 123' ) ); |
| 22 | + $this->assertEquals( '[[Special:Code/Test/456|r456]]', $formatter->link( 'r456' ) ); |
| 23 | + // fails, bug 23203 and so on |
| 24 | + //$this->assertEquals( '[http://example.org foo http://example.org foo]', $formatter->link( '[http://example.org foo http://example.org foo]' ) ); |
| 25 | + //$this->assertEquals( '[http://foo.bar r123]', $formatter->link( '[http://foo.bar r123]' ) ); |
| 26 | + } |
| 27 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/CodeReview/tests/CodeReviewTest.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 28 | + native |