MediaWiki REL1_33
AvroFormatterTest.php
Go to the documentation of this file.
1<?php
22
24use PHPUnit_Framework_Error_Notice;
25
30
31 protected function setUp() {
32 if ( !class_exists( 'AvroStringIO' ) ) {
33 $this->markTestSkipped( 'Avro is required for the AvroFormatterTest' );
34 }
35 parent::setUp();
36 }
37
38 public function testSchemaNotAvailable() {
39 $formatter = new AvroFormatter( [] );
41 'PHPUnit_Framework_Error_Notice',
42 "The schema for channel 'marty' is not available"
43 );
44 $formatter->format( [ 'channel' => 'marty' ] );
45 }
46
48 $formatter = new AvroFormatter( [] );
49 $noticeEnabled = PHPUnit_Framework_Error_Notice::$enabled;
50 // disable conversion of notices
51 PHPUnit_Framework_Error_Notice::$enabled = false;
52 // have to keep the user notice from being output
54 $res = $formatter->format( [ 'channel' => 'marty' ] );
56 PHPUnit_Framework_Error_Notice::$enabled = $noticeEnabled;
57 $this->assertNull( $res );
58 }
59
61 $formatter = new AvroFormatter( [
62 'string' => [
63 'schema' => [ 'type' => 'string' ],
64 'revision' => 1010101,
65 ]
66 ] );
67 $res = $formatter->format( [
68 'channel' => 'string',
69 'context' => 'better to be',
70 ] );
71 $this->assertNotNull( $res );
72 // basically just tell us if avro changes its string encoding, or if
73 // we completely fail to generate a log message.
74 $this->assertEquals( 'AAAAAAAAD2m1GGJldHRlciB0byBiZQ==', base64_encode( $res ) );
75 }
76}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
\MediaWiki\Logger\Monolog\AvroFormatter
Log message formatter that uses the apache Avro format.
$res
Definition database.txt:21