X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fchanges%2FRecentChangeTest.php;h=60235b8f12dc231d064fb76c942344621b759df8;hb=8a1152b91365fe51f2505c8dc30dc20319dcafd4;hp=e39c3823cd6429ba0308e79e5946ec8550ed2626;hpb=d1150378f15b4dd699220bee41d0ce3af8868a18;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/changes/RecentChangeTest.php b/tests/phpunit/includes/changes/RecentChangeTest.php index e39c3823cd..60235b8f12 100644 --- a/tests/phpunit/includes/changes/RecentChangeTest.php +++ b/tests/phpunit/includes/changes/RecentChangeTest.php @@ -243,7 +243,9 @@ class RecentChangeTest extends MediaWikiTestCase { $this->context->msg( 'movedarticleprotection', 'SomeTitle', 'OldTitle' ) ->plain() . $sep . $this->user_comment, 'protect', 'move_prot', - array( 'OldTitle' ), + array( + '4::oldtitle' => 'OldTitle' + ), $this->user_comment ); } @@ -297,16 +299,22 @@ class RecentChangeTest extends MediaWikiTestCase { $sep = $this->context->msg( 'colon-separator' )->text(); # import/upload + $msg = $this->context->msg( 'import-logentry-upload', 'SomeTitle' )->plain() . + $sep . + $this->user_comment; $this->assertIRCComment( - $this->context->msg( 'import-logentry-upload', 'SomeTitle' )->plain() . $sep . $this->user_comment, + $msg, 'import', 'upload', array(), $this->user_comment ); # import/interwiki + $msg = $this->context->msg( 'import-logentry-interwiki', 'SomeTitle' )->plain() . + $sep . + $this->user_comment; $this->assertIRCComment( - $this->context->msg( 'import-logentry-interwiki', 'SomeTitle' )->plain() . $sep . $this->user_comment, + $msg, 'import', 'interwiki', array(), $this->user_comment @@ -336,6 +344,51 @@ class RecentChangeTest extends MediaWikiTestCase { } */ + /** + * @covers RecentChange::parseParams + */ + public function testParseParams() { + $params = array( + 'root' => array( + 'A' => 1, + 'B' => 'two' + ) + ); + + $this->assertParseParams( + $params, + 'a:1:{s:4:"root";a:2:{s:1:"A";i:1;s:1:"B";s:3:"two";}}' + ); + + $this->assertParseParams( + null, + null + ); + + $this->assertParseParams( + null, + serialize( false ) + ); + + $this->assertParseParams( + null, + 'not-an-array' + ); + } + + /** + * @param array $expectedParseParams + * @param string|null $rawRcParams + */ + protected function assertParseParams( $expectedParseParams, $rawRcParams ) { + $rc = new RecentChange; + $rc->setAttribs( array( 'rc_params' => $rawRcParams ) ); + + $actualParseParams = $rc->parseParams(); + + $this->assertEquals( $expectedParseParams, $actualParseParams ); + } + /** * @param string $expected Expected IRC text without colors codes * @param string $type Log type (move, delete, suppress, patrol ...)