From 5a0aec1348bfe06b1a085ffe02bfad4e2f190f00 Mon Sep 17 00:00:00 2001 From: addshore Date: Sat, 25 Jan 2014 16:08:49 +0100 Subject: [PATCH] Add test for Status->merge with overrideValue true Change-Id: I049c67e80277f8dbbbadae6e7a8f30d66066e7bf --- tests/phpunit/includes/StatusTest.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 */ -- 2.20.1