Fix issues identified by SpaceBeforeSingleLineComment sniff
[lhc/web/wiklou.git] / tests / phpunit / includes / StatusTest.php
index 44463cf..c95e69b 100644 (file)
@@ -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,
                        "<fooBar!>",
@@ -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' ),