class AvroFormatterTest extends MediaWikiTestCase {
- public function setUp() {
+ protected function setUp() {
if ( !class_exists( 'AvroStringIO' ) ) {
$this->markTestSkipped( 'Avro is required for the AvroFormatterTest' );
}
public function testSchemaNotAvailable() {
$formatter = new AvroFormatter( array() );
- $this->setExpectedException( 'PHPUnit_Framework_Error_Notice', "The schema for channel 'marty' is not available" );
+ $this->setExpectedException(
+ 'PHPUnit_Framework_Error_Notice',
+ "The schema for channel 'marty' is not available"
+ );
$formatter->format( array( 'channel' => 'marty' ) );
}
}
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 ) );
}
}