From: addshore Date: Sat, 25 Jan 2014 15:11:57 +0000 (+0100) Subject: Add test that covers Status::fatal X-Git-Tag: 1.31.0-rc.0~17144^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=commitdiff_plain;h=876b33bb4beb3c9b4f09ac78d0e6910c3e1d5daa;p=lhc%2Fweb%2Fwiklou.git Add test that covers Status::fatal Change-Id: I7cb1e19569f77df5230808d7b35200b0ec9a6698 --- diff --git a/tests/phpunit/includes/StatusTest.php b/tests/phpunit/includes/StatusTest.php index aa5367ec9d..08c1470b09 100644 --- a/tests/phpunit/includes/StatusTest.php +++ b/tests/phpunit/includes/StatusTest.php @@ -166,6 +166,29 @@ class StatusTest extends MediaWikiLangTestCase { } } + /** + * @dataProvider provideMockMessageDetails + * @covers Status::fatal + * @covers Status::getErrorsArray + * @covers Status::getStatusArray + */ + public function testFatalWithMessage( $mockDetails ) { + $status = new Status(); + $messages = $this->getMockMessages( $mockDetails ); + + foreach ( $messages as $message ) { + $status->fatal( $message ); + } + $errors = $status->getErrorsArray(); + + $this->assertEquals( count( $messages ), count( $errors ) ); + foreach ( $messages as $key => $message ) { + $expectedArray = array_merge( array( $message->getKey() ), $message->getParams() ); + $this->assertEquals( $errors[$key], $expectedArray ); + } + $this->assertFalse( $status->isOK() ); + } + protected function getMockMessage( $key = 'key', $params = array() ) { $message = $this->getMockBuilder( 'Message' ) ->disableOriginalConstructor()