Merge "Fix magic getter for $status->ok"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 14 Feb 2015 00:44:14 +0000 (00:44 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 14 Feb 2015 00:44:14 +0000 (00:44 +0000)
includes/Status.php
tests/phpunit/includes/StatusTest.php

index 61a0047..cd10258 100644 (file)
@@ -437,7 +437,7 @@ class Status {
         */
        function __get( $name ) {
                if ( $name === 'ok' ) {
-                       return $this->sv->getOK();
+                       return $this->sv->isOK();
                } elseif ( $name === 'errors' ) {
                        return $this->sv->getErrors();
                }
index 44463cf..c013f4f 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