From 31ea82f68aa754bbb939b6f65850c1c32db62c75 Mon Sep 17 00:00:00 2001 From: addshore Date: Thu, 6 Mar 2014 21:19:15 +0100 Subject: [PATCH] Revert "Add getMessage tests with Short and Long Contexts" Looking at the getMessage function the long and short contexts should be strings not bools. I was misslead by the defaults thus these tests aren't actually testing much and should be removed to avoid misslead more people! This reverts commit cd9711ea350e9367829702eddc0adad8c9d88afb. Change-Id: I889d42f720bf678a3543860893d0fedfca757dce --- tests/phpunit/includes/StatusTest.php | 59 ++------------------------- 1 file changed, 4 insertions(+), 55 deletions(-) diff --git a/tests/phpunit/includes/StatusTest.php b/tests/phpunit/includes/StatusTest.php index 438677068d..209b54c3e6 100644 --- a/tests/phpunit/includes/StatusTest.php +++ b/tests/phpunit/includes/StatusTest.php @@ -371,20 +371,11 @@ class StatusTest extends MediaWikiLangTestCase { /** * @dataProvider provideGetMessage * @covers Status::getMessage - * @todo test with multiple messages at once + * @todo test long and short context messages generated through this method */ - public function testGetMessage( Status $status, $expectedParams = array(), $expectedKey, $shortContext = false, $longContext = false ) { - $message = $status->getMessage( $shortContext, $longContext ); + public function testGetMessage( Status $status, $expectedParams = array(), $expectedKey ) { + $message = $status->getMessage(); $this->assertInstanceOf( 'Message', $message ); - - // Loop through until we get to the appropriate depth for the message - $loops = $shortContext ? 1 : ( $longContext ? 2 : 0 ); - for( $i = 1; $i <= $loops; $i++ ) { - $params = $message->getParams(); - $this->assertInstanceOf( 'Message', $params[0] ); - $message = $params[0]; - } - $this->assertEquals( $expectedParams, $message->getParams() ); $this->assertEquals( $expectedKey, $message->getKey() ); } @@ -392,7 +383,7 @@ class StatusTest extends MediaWikiLangTestCase { /** * @return array of arrays with values; * 0 => status object - * 1 => expected Message Params + * 1 => expected Message Params (with no context) */ public static function provideGetMessage() { $testCases = array(); @@ -411,21 +402,6 @@ class StatusTest extends MediaWikiLangTestCase { 'internalerror_info' ); - $testCases[ 'GoodButNoErrorShortContext' ] = array( - $status, - array( "Status::getMessage: Invalid result object: no error text but not OK\n" ), - 'internalerror_info', - true - ); - - $testCases[ 'GoodButNoErrorLongContext' ] = array( - $status, - array( "Status::getMessage: Invalid result object: no error text but not OK\n" ), - 'internalerror_info', - false, - true - ); - $status = new Status(); $status->warning( 'fooBar!' ); $testCases[ '1StringWarning' ] = array( @@ -462,33 +438,6 @@ class StatusTest extends MediaWikiLangTestCase { // "", // ); - $status = new Status(); - $status->error( new Message( 'fooBar!', array( 'foo', 'bar' ) ) ); - $testCases[ '1MessageError' ] = array( - $status, - array( 'foo', 'bar' ), - "fooBar!", - ); - - $status = new Status(); - $status->error( new Message( 'fooBar!', array( 'foo', 'bar' ) ) ); - $testCases[ '1MessageErrorShortContext' ] = array( - $status, - array( 'foo', 'bar' ), - "fooBar!", - true, - ); - - $status = new Status(); - $status->error( new Message( 'fooBar!', array( 'foo', 'bar' ) ) ); - $testCases[ '1MessageErrorLongContext' ] = array( - $status, - array( 'foo', 'bar' ), - "fooBar!", - false, - true, - ); - return $testCases; } -- 2.20.1