Merge "Remove extra line breaks in memcached debug output"
[lhc/web/wiklou.git] / tests / phpunit / includes / debug / logger / monolog / AvroFormatterTest.php
index 4c6d25e..b28de57 100644 (file)
@@ -25,7 +25,7 @@ use PHPUnit_Framework_Error_Notice;
 
 class AvroFormatterTest extends MediaWikiTestCase {
 
-       public function setUo() {
+       protected function setUp() {
                if ( !class_exists( 'AvroStringIO' ) ) {
                        $this->markTestSkipped( 'Avro is required for the AvroFormatterTest' );
                }
@@ -33,15 +33,18 @@ class AvroFormatterTest extends MediaWikiTestCase {
        }
 
        public function testSchemaNotAvailable() {
-               $formatter = new AvroFormatter( array() );      
-               $this->setExpectedException( 'PHPUnit_Framework_Error_Notice', "The schema for channel 'marty' is not available" );
+               $formatter = new AvroFormatter( array() );
+               $this->setExpectedException(
+                       'PHPUnit_Framework_Error_Notice',
+                       "The schema for channel 'marty' is not available"
+               );
                $formatter->format( array( 'channel' => 'marty' ) );
        }
 
        public function testSchemaNotAvailableReturnValue() {
-               $formatter = new AvroFormatter( array() );      
+               $formatter = new AvroFormatter( array() );
                $noticeEnabled = PHPUnit_Framework_Error_Notice::$enabled;
-               // disable conversion of notices 
+               // disable conversion of notices
                PHPUnit_Framework_Error_Notice::$enabled = false;
                // have to keep the user notice from being output
                wfSuppressWarnings();
@@ -52,13 +55,19 @@ class AvroFormatterTest extends MediaWikiTestCase {
        }
 
        public function testDoesSomethingWhenSchemaAvailable() {
-               $formatter = new AvroFormatter( array( 'string' => array( 'type' => 'string' ) ) );
+               $formatter = new AvroFormatter( array(
+                       'string' => array(
+                               'schema' => array( 'type' => 'string' ),
+                               'revision' => 1010101,
+                       )
+               ) );
                $res = $formatter->format( array(
                        'channel' => 'string',
                        'context' => 'better to be',
                ) );
                $this->assertNotNull( $res );
-               // basically just tell us if avro changes its string encoding
-               $this->assertEquals( base64_decode( 'GGJldHRlciB0byBiZQ==' ), $res );
+               // basically just tell us if avro changes its string encoding, or if
+               // we completely fail to generate a log message.
+               $this->assertEquals( 'AAAAAAAAD2m1GGJldHRlciB0byBiZQ==', base64_encode( $res ) );
        }
 }