summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/api/ApiMessageTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/api/ApiMessageTest.php')
-rw-r--r--tests/phpunit/includes/api/ApiMessageTest.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/phpunit/includes/api/ApiMessageTest.php b/tests/phpunit/includes/api/ApiMessageTest.php
index 6c3ce60d..08a984eb 100644
--- a/tests/phpunit/includes/api/ApiMessageTest.php
+++ b/tests/phpunit/includes/api/ApiMessageTest.php
@@ -14,9 +14,13 @@ class ApiMessageTest extends MediaWikiTestCase {
$msg = TestingAccessWrapper::newFromObject( $msg );
$msg2 = TestingAccessWrapper::newFromObject( $msg2 );
- foreach ( array( 'interface', 'useDatabase', 'title' ) as $key ) {
- $this->assertSame( $msg->$key, $msg2->$key, $key );
- }
+ $this->assertSame( $msg->interface, $msg2->interface, 'interface' );
+ $this->assertSame( $msg->useDatabase, $msg2->useDatabase, 'useDatabase' );
+ $this->assertSame(
+ $msg->title ? $msg->title->getFullText() : null,
+ $msg2->title ? $msg2->title->getFullText() : null,
+ 'title'
+ );
}
/**
@@ -30,6 +34,11 @@ class ApiMessageTest extends MediaWikiTestCase {
$this->assertEquals( 'code', $msg2->getApiCode() );
$this->assertEquals( array( 'data' ), $msg2->getApiData() );
+ $msg2 = unserialize( serialize( $msg2 ) );
+ $this->compareMessages( $msg, $msg2 );
+ $this->assertEquals( 'code', $msg2->getApiCode() );
+ $this->assertEquals( array( 'data' ), $msg2->getApiData() );
+
$msg = new Message( array( 'foo', 'bar' ), array( 'baz' ) );
$msg2 = new ApiMessage( array( array( 'foo', 'bar' ), 'baz' ), 'code', array( 'data' ) );
$this->compareMessages( $msg, $msg2 );
@@ -63,6 +72,11 @@ class ApiMessageTest extends MediaWikiTestCase {
$this->assertEquals( 'code', $msg2->getApiCode() );
$this->assertEquals( array( 'data' ), $msg2->getApiData() );
+ $msg2 = unserialize( serialize( $msg2 ) );
+ $this->compareMessages( $msg, $msg2 );
+ $this->assertEquals( 'code', $msg2->getApiCode() );
+ $this->assertEquals( array( 'data' ), $msg2->getApiData() );
+
$msg = new RawMessage( 'foo', array( 'baz' ) );
$msg2 = new ApiRawMessage( array( 'foo', 'baz' ), 'code', array( 'data' ) );
$this->compareMessages( $msg, $msg2 );