Merge "Switched upload chunk status store to the main object stash"
[lhc/web/wiklou.git] / tests / phpunit / includes / StatusTest.php
index 628c59b..291ed31 100644 (file)
@@ -56,6 +56,17 @@ 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
@@ -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() );
        }
 
@@ -359,7 +372,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!>",
@@ -436,7 +449,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,
                        array( 'foo', 'bar' ),