r94665 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94664‎ | r94665 | r94666 >
Date:17:33, 16 August 2011
Author:demon
Status:ok
Tags:
Comment:
MFT r94506
Modified paths:
  • /branches/REL1_18/extensions/CodeReview/backend/CodeRevision.php (modified) (history)
  • /branches/REL1_18/extensions/CodeReview/tests/CodeReviewTest.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/extensions/CodeReview/backend/CodeRevision.php
@@ -1241,10 +1241,11 @@
12421242 * @param string $commentId
12431243 * @return \type
12441244 */
1245 - public function getFullUrl( $commentId = '' ) {
 1245+ public function getFullUrl( $commentId = 0 ) {
12461246 $title = SpecialPage::getTitleFor( 'Code', $this->repo->getName() . '/' . $this->id );
12471247
1248 - if ( $commentId !== '' ) {
 1248+ # Append comment id if not null, empty string or zero
 1249+ if ( $commentId ) {
12491250 $title->setFragment( "#c{$commentId}" );
12501251 }
12511252
Property changes on: branches/REL1_18/extensions/CodeReview/backend/CodeRevision.php
___________________________________________________________________
Added: svn:mergeinfo
12521253 Merged /trunk/extensions/CodeReview/backend/CodeRevision.php:r94506
12531254 Merged /backend/CodeRevision.php:r91549
Index: branches/REL1_18/extensions/CodeReview/tests/CodeReviewTest.php
@@ -40,4 +40,28 @@
4141
4242 // $this->assertEquals( '', $formatter->link( '' ) );
4343 }
44 -}
\ No newline at end of file
 44+
 45+ public function testCommentFullUrl() {
 46+ # Fixture:
 47+ $repo = $this->createRepo();
 48+ $cr = CodeRevision::newFromSvn( $repo, array(
 49+ 'rev' => 305,
 50+ 'author' => 'hashar',
 51+ 'date' => '15 august 2011',
 52+ 'msg' => 'dumb revision message',
 53+ 'paths' => array( '/dev/null' ),
 54+ )
 55+ );
 56+
 57+ # Find out our revision root URL
 58+ $baseUrl = SpecialPage::getTitleFor( 'Code', $repo->getName().'/305' )->getFullUrl();
 59+
 60+ # Test revision URL with various comment id:
 61+ $this->assertEquals( $baseUrl, $cr->getFullUrl( '' ) );
 62+ $this->assertEquals( $baseUrl, $cr->getFullUrl( 0 ) );
 63+ $this->assertEquals( $baseUrl, $cr->getFullUrl( null ) );
 64+ $this->assertEquals( $baseUrl, $cr->getFullUrl( "0" ) );
 65+ $this->assertEquals( $baseUrl . '#c777', $cr->getFullUrl( 777 ) );
 66+ $this->assertEquals( $baseUrl . '#c777', $cr->getFullUrl( "777" ) );
 67+ }
 68+}
Property changes on: branches/REL1_18/extensions/CodeReview/tests/CodeReviewTest.php
___________________________________________________________________
Added: svn:mergeinfo
4569 Merged /trunk/extensions/CodeReview/tests/CodeReviewTest.php:r94506
4670 Merged /tests/CodeReviewTest.php:r91549

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r94506get ride of #c0 in URLhashar12:55, 15 August 2011

Status & tagging log