$dbw = wfGetDB( DB_MASTER );
$dbw->update( 'revision',
- array( 'rev_timestamp' => $timestamp ),
+ array( 'rev_timestamp' => $dbw->timestamp( $timestamp ) ),
array( 'rev_id' => $page->getLatest() ) );
$page->clear();
* wrapper around assertEquals() which calls rrtrim() to normalize the
* expected and actual texts.
*/
- function assertEditedTextEquals( $expected, $actual, $msg='' ) {
- return $this->assertEquals( rtrim($expected), rtrim($actual), $msg );
+ function assertEditedTextEquals( $expected, $actual, $msg = '' ) {
+ return $this->assertEquals( rtrim( $expected ), rtrim( $actual ), $msg );
}
/**
}
public static function provideSectionEdit() {
- $text =
-'Intro
+ $text = 'Intro
== one ==
first section.
second section.
';
- $sectionOne =
-'== one ==
+ $sectionOne = '== one ==
hello
';
- $newSection =
-'== new section ==
+ $newSection = '== new section ==
hello
';
- $textWithNewSectionOne = preg_replace( '/== one ==.*== two ==/ms',
- "$sectionOne\n== two ==", $text );
+ $textWithNewSectionOne = preg_replace(
+ '/== one ==.*== two ==/ms',
+ "$sectionOne\n== two ==", $text
+ );
$textWithNewSectionAdded = "$text\n$newSection";
);
// see whether it makes a difference who did the base edit
- $testsWithAdam = array_map( function( $test ) {
+ $testsWithAdam = array_map( function ( $test ) {
$test[0] = 'Adam'; // change base edit user
return $test;
}, $tests );
- $testsWithBerta = array_map( function( $test ) {
+ $testsWithBerta = array_map( function ( $test ) {
$test[0] = 'Berta'; // change base edit user
return $test;
}, $tests );
return array_merge( $tests, $testsWithAdam, $testsWithBerta );
}
- function testHasValidDiff3() {
- global $wgDiff3;
-
- if ( !$wgDiff3 ) {
- $this->markTestSkipped( "Can't test conflict resolution because \$wgDiff3 is not configured" );
- } elseif ( !file_exists( $wgDiff3 ) ) {
- #XXX: this sucks, since it uses arcane internal knowledge about TextContentHandler::merge3 and wfMerge.
- $this->markTestSkipped( "Can't test conflict resolution because \$wgDiff3 is misconfigured: can't find $wgDiff3" );
- }
- $this->assertTrue( true );
- }
-
/**
- * @depend testHasValidDiff3
* @dataProvider provideAutoMerge
*/
public function testAutoMerge( $baseUser, $text, $adamsEdit, $bertasEdit,
- $expectedCode, $expectedText, $message = null
+ $expectedCode, $expectedText, $message = null
) {
+ $this->checkHasDiff3();
//create page
$ns = $this->getDefaultWikitextNS();
);
$page = $this->assertEdit( 'EditPageTest_testAutoMerge', null,
- $baseUser, $baseEdit, null, null, __METHOD__ );
+ $baseUser, $baseEdit, null, null, __METHOD__ );
$this->forceRevisionDate( $page, '20120101000000' );