X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FStatusTest.php;h=c95e69b60c713a9ffefb05a52344b1a956596b18;hb=c54766586acab549f186e81eeab259845112809d;hp=44463cf6d79834e07d00e823c0e6f2d5e52a94ba;hpb=1e209d1e74cf2c0f5f78a3ca8014fc0af9d7f0a5;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/StatusTest.php b/tests/phpunit/includes/StatusTest.php index 44463cf6d7..c95e69b60c 100644 --- a/tests/phpunit/includes/StatusTest.php +++ b/tests/phpunit/includes/StatusTest.php @@ -56,6 +56,26 @@ class StatusTest extends MediaWikiLangTestCase { $this->assertEquals( $message, $status->getMessage()->getKey() ); } + /** + * + */ + 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 @@ -361,7 +381,7 @@ class StatusTest extends MediaWikiLangTestCase { ); $status = new Status(); - $status->warning( new Message( 'fooBar!', array( 'foo', 'bar' ) ) ); + $status->warning( new Message( 'fooBar!', array( 'foo', 'bar' ) ) ); $testCases['1MessageWarning'] = array( $status, "", @@ -428,17 +448,17 @@ class StatusTest extends MediaWikiLangTestCase { // and the first call to the setUp method. Because of that you can't access any variables // you create there from within a data provider." // http://phpunit.de/manual/3.7/en/writing-tests-for-phpunit.html -// $status = new Status(); -// $status->warning( 'fooBar!' ); -// $status->warning( 'fooBar2!' ); -// $testCases[ '2StringWarnings' ] = array( -// $status, -// array( new Message( 'fooBar!' ), new Message( 'fooBar2!' ) ), -// "* \$1\n* \$2" -// ); +// $status = new Status(); +// $status->warning( 'fooBar!' ); +// $status->warning( 'fooBar2!' ); +// $testCases[ '2StringWarnings' ] = array( +// $status, +// array( new Message( 'fooBar!' ), new Message( 'fooBar2!' ) ), +// "* \$1\n* \$2" +// ); $status = new Status(); - $status->warning( new Message( 'fooBar!', array( 'foo', 'bar' ) ) ); + $status->warning( new Message( 'fooBar!', array( 'foo', 'bar' ) ) ); $testCases['1MessageWarning'] = array( $status, array( 'foo', 'bar' ),