Skip to content

Commit

Permalink
Item11983: fixed unit tests computing the rev id of pending checkins
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@15269 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Aug 8, 2012
1 parent a28ee44 commit cf90124
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions UnitTestContrib/test/unit/LoadedRevTests.pm
Original file line number Diff line number Diff line change
Expand Up @@ -221,22 +221,39 @@ SICK
$topicObject->finish();
($topicObject) =
Foswiki::Func::readTopic( $this->{test_web}, "BorkedTOPICINFO", 3 );
$this->assert_equals( 2, $topicObject->getLoadedRev() );
$this->assert_equals( 3, $topicObject->getLoadedRev() )
; # that's 3 because there's a checkin pending
$this->assert_matches( qr/lovely muck/, $topicObject->text() );

# load out of range rev
$topicObject->finish();
($topicObject) =
Foswiki::Func::readTopic( $this->{test_web}, "BorkedTOPICINFO", 4 );
$this->assert_equals( 3, $topicObject->getLoadedRev() );
$this->assert_matches( qr/lovely muck/, $topicObject->text() );

# commit the pending checkin
$topicObject->save( forcenewrevision => 1 );
$topicObject->finish();

# testing rev info
($topicObject) =
Foswiki::Func::readTopic( $this->{test_web}, "BorkedTOPICINFO", 0 );
$this->assert_equals( 3, $topicObject->getLoadedRev() )
; # that's the real revision now

# Should ignore the TOPICINFO and return the "true" revision
$this->assert_equals( 2, $topicObject->getLoadedRev() );
my $info = $topicObject->getRevisionInfo();
$this->assert_equals( $Foswiki::Users::BaseUserMapping::UNKNOWN_USER_CUID,
$info->{author} );
$this->assert( $info->{date} );
$this->assert_equals( 3, $info->{version} );

# If we now save it, we should be back to corrected rev nos
$topicObject->save( forcenewrevision => 1 );
$topicObject->finish();
($topicObject) =
Foswiki::Func::readTopic( $this->{test_web}, "BorkedTOPICINFO", 0 );
$this->assert_equals( 3, $topicObject->getLoadedRev() );
$this->assert_equals( 4, $topicObject->getLoadedRev() );
}

1;

0 comments on commit cf90124

Please sign in to comment.