From: addshore Date: Sat, 25 Jan 2014 15:08:49 +0000 (+0100) Subject: Add test for Status->merge with overrideValue true X-Git-Tag: 1.31.0-rc.0~17145^2 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=5a0aec1348bfe06b1a085ffe02bfad4e2f190f00;p=lhc%2Fweb%2Fwiklou.git Add test for Status->merge with overrideValue true Change-Id: I049c67e80277f8dbbbadae6e7a8f30d66066e7bf --- diff --git a/tests/phpunit/includes/StatusTest.php b/tests/phpunit/includes/StatusTest.php index a3d68b6eee..aa5367ec9d 100644 --- a/tests/phpunit/includes/StatusTest.php +++ b/tests/phpunit/includes/StatusTest.php @@ -200,7 +200,6 @@ class StatusTest extends MediaWikiLangTestCase { /** * @covers Status::merge - * @todo test merge with $overwriteValue true */ public function testMerge() { $status1 = new Status(); @@ -214,6 +213,23 @@ class StatusTest extends MediaWikiLangTestCase { $this->assertEquals( 2, count( $status1->getWarningsArray() ) + count( $status1->getErrorsArray() ) ); } + /** + * @covers Status::merge + */ + public function testMergeWithOverwriteValue() { + $status1 = new Status(); + $status2 = new Status(); + $message1 = $this->getMockMessage( 'warn1' ); + $message2 = $this->getMockMessage( 'error2' ); + $status1->warning( $message1 ); + $status2->error( $message2 ); + $status2->value = 'FooValue'; + + $status1->merge( $status2, true ); + $this->assertEquals( 2, count( $status1->getWarningsArray() ) + count( $status1->getErrorsArray() ) ); + $this->assertEquals( 'FooValue', $status1->getValue() ); + } + /** * @covers Status::hasMessage */