r69611 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69610‎ | r69611 | r69612 >
Date:13:36, 20 July 2010
Author:maxsem
Status:ok
Tags:
Comment:
CodeReview: initial comment parser tests. So far only basic tests of what we're doing, tests that fail are commented out
Modified paths:
  • /trunk/extensions/CodeReview/CodeReview.php (modified) (history)
  • /trunk/extensions/CodeReview/tests (added) (history)
  • /trunk/extensions/CodeReview/tests/CodeReviewTest.php (added) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeReview.php
@@ -177,3 +177,10 @@
178178 return true;
179179 }
180180
 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
128 + native

Status & tagging log