markTestSkipped( 'Avro is required for the AvroFormatterTest' ); } parent::setUp(); } public function testSchemaNotAvailable() { $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() ); $noticeEnabled = PHPUnit_Framework_Error_Notice::$enabled; // disable conversion of notices PHPUnit_Framework_Error_Notice::$enabled = false; // have to keep the user notice from being output wfSuppressWarnings(); $res = $formatter->format( array( 'channel' => 'marty' ) ); wfRestoreWarnings(); PHPUnit_Framework_Error_Notice::$enabled = $noticeEnabled; $this->assertNull( $res ); } public function testDoesSomethingWhenSchemaAvailable() { $formatter = new AvroFormatter( array( 'string' => array( 'type' => 'string' ) ) ); $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 ); } }