diff options
Diffstat (limited to 'tests/phpunit/includes/StatusTest.php')
-rw-r--r-- | tests/phpunit/includes/StatusTest.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/phpunit/includes/StatusTest.php b/tests/phpunit/includes/StatusTest.php index 628c59b6..c013f4fc 100644 --- a/tests/phpunit/includes/StatusTest.php +++ b/tests/phpunit/includes/StatusTest.php @@ -57,6 +57,17 @@ class StatusTest extends MediaWikiLangTestCase { } /** + * + */ + public function testOkAndErrors() { + $status = Status::newGood( 'foo' ); + $this->assertTrue( $status->ok ); + $status = Status::newFatal( 'foo', 1, 2 ); + $this->assertFalse( $status->ok ); + $this->assertArrayEquals( array( array( 'type' => 'error', 'message' => 'foo', 'params' => array( 1, 2 ) ) ), $status->errors ); + } + + /** * @dataProvider provideSetResult * @covers Status::setResult */ @@ -109,7 +120,9 @@ class StatusTest extends MediaWikiLangTestCase { public function testIsGood( $ok, $errors, $expected ) { $status = new Status(); $status->ok = $ok; - $status->errors = $errors; + foreach ( $errors as $error ) { + $status->warning( $error ); + } $this->assertEquals( $expected, $status->isGood() ); } |