From 4b28a3746f769a027c5f1017571518a06bd138a1 Mon Sep 17 00:00:00 2001 From: addshore Date: Sat, 22 Feb 2014 12:00:18 +0100 Subject: [PATCH] Add test to complete coverage of getStatusArray Change-Id: Ia2f9b5a723d85d19ee7a24fcf9b132d0289705f0 --- tests/phpunit/includes/StatusTest.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/phpunit/includes/StatusTest.php b/tests/phpunit/includes/StatusTest.php index 9cafe2c519..209b54c3e6 100644 --- a/tests/phpunit/includes/StatusTest.php +++ b/tests/phpunit/includes/StatusTest.php @@ -531,4 +531,29 @@ class StatusTest extends MediaWikiLangTestCase { $this->assertEquals( false, $status->cleanCallback ); } + /** + * @dataProvider provideNonObjectMessages + * @covers Status::getStatusArray + */ + public function testGetStatusArrayWithNonObjectMessages( $nonObjMsg ) { + $status = new Status(); + if( !array_key_exists( 1, $nonObjMsg ) ) { + $status->warning( $nonObjMsg[0] ); + } else { + $status->warning( $nonObjMsg[0], $nonObjMsg[1] ); + } + + $array = $status->getWarningsArray(); // We use getWarningsArray to access getStatusArray + + $this->assertEquals( 1, count( $array ) ); + $this->assertEquals( $nonObjMsg, $array[0] ); + } + + public static function provideNonObjectMessages() { + return array( + array( array( 'ImaString', array( 'param1' => 'value1' ) ) ), + array( array( 'ImaString' ) ), + ); + } + } -- 2.20.1