markTestSkipped( 'Avro is required for the AvroFormatterTest' ); } parent::setUp(); } public function testSchemaNotAvailable() { $formatter = new AvroFormatter( [] ); $this->expectException( Notice::class ); $this->expectExceptionMessage( "The schema for channel 'marty' is not available" ); $formatter->format( [ 'channel' => 'marty' ] ); } public function testSchemaNotAvailableReturnValue() { $formatter = new AvroFormatter( [] ); // have to keep the user notice from being output AtEase::suppressWarnings(); $res = $formatter->format( [ 'channel' => 'marty' ] ); AtEase::restoreWarnings(); $this->assertNull( $res ); } public function testDoesSomethingWhenSchemaAvailable() { $formatter = new AvroFormatter( [ 'string' => [ 'schema' => [ 'type' => 'string' ], 'revision' => 1010101, ] ] ); $res = $formatter->format( [ 'channel' => 'string', 'context' => 'better to be', ] ); $this->assertNotNull( $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 ) ); } }