25use Wikimedia\TestingAccessWrapper;
33 if ( !class_exists(
'Monolog\Handler\AbstractProcessingHandler' )
34 || !class_exists(
'Kafka\Produce' )
36 $this->markTestSkipped(
'Monolog and Kafka are required for the KafkaHandlerTest' );
44 [ [],
'monolog_foo' ],
45 [ [
'alias' => [
'foo' =>
'bar' ] ],
'bar' ]
53 $produce = $this->getMockBuilder(
'Kafka\Produce' )
54 ->disableOriginalConstructor()
56 $produce->expects( $this->
any() )
57 ->method(
'getAvailablePartitions' )
58 ->will( $this->returnValue( [
'A' ] ) );
59 $produce->expects( $this->once() )
60 ->method(
'setMessages' )
62 $produce->expects( $this->
any() )
64 ->will( $this->returnValue(
true ) );
69 'level' => Logger::EMERGENCY,
80 [ [
'swallowExceptions' =>
false ],
true ],
82 [ [
'swallowExceptions' =>
true ],
false ],
90 $produce = $this->getMockBuilder(
'Kafka\Produce' )
91 ->disableOriginalConstructor()
93 $produce->expects( $this->
any() )
94 ->method(
'getAvailablePartitions' )
95 ->will( $this->throwException(
new \Kafka\Exception ) );
96 $produce->expects( $this->
any() )
98 ->will( $this->returnValue(
true ) );
100 if ( $expectException ) {
101 $this->setExpectedException(
'Kafka\Exception' );
107 'level' => Logger::EMERGENCY,
112 if ( !$expectException ) {
113 $this->assertTrue(
true,
'no exception was thrown' );
121 $produce = $this->getMockBuilder(
'Kafka\Produce' )
122 ->disableOriginalConstructor()
124 $produce->expects( $this->
any() )
125 ->method(
'getAvailablePartitions' )
126 ->will( $this->returnValue( [
'A' ] ) );
127 $produce->expects( $this->
any() )
129 ->will( $this->throwException(
new \Kafka\Exception ) );
131 if ( $expectException ) {
132 $this->setExpectedException(
'Kafka\Exception' );
138 'level' => Logger::EMERGENCY,
143 if ( !$expectException ) {
144 $this->assertTrue(
true,
'no exception was thrown' );
149 $produce = $this->getMockBuilder(
'Kafka\Produce' )
150 ->disableOriginalConstructor()
152 $produce->expects( $this->
any() )
153 ->method(
'getAvailablePartitions' )
154 ->will( $this->returnValue( [
'A' ] ) );
155 $mockMethod = $produce->expects( $this->exactly( 2 ) )
156 ->method(
'setMessages' );
157 $produce->expects( $this->
any() )
159 ->will( $this->returnValue(
true ) );
161 $matcher = TestingAccessWrapper::newFromObject( $mockMethod )->matcher;
162 TestingAccessWrapper::newFromObject( $matcher )->parametersMatcher =
163 new \PHPUnit_Framework_MockObject_Matcher_ConsecutiveParameters( [
168 $formatter = $this->createMock( \Monolog\Formatter\FormatterInterface::class );
169 $formatter->expects( $this->
any() )
171 ->will( $this->onConsecutiveCalls(
'words',
null,
'lines' ) );
174 $handler->setFormatter( $formatter );
175 for ( $i = 0; $i < 3; ++$i ) {
178 'level' => Logger::EMERGENCY,
186 $produce = $this->getMockBuilder(
'Kafka\Produce' )
187 ->disableOriginalConstructor()
189 $produce->expects( $this->
any() )
190 ->method(
'getAvailablePartitions' )
191 ->will( $this->returnValue( [
'A' ] ) );
192 $produce->expects( $this->once() )
193 ->method(
'setMessages' )
195 $produce->expects( $this->
any() )
197 ->will( $this->returnValue(
true ) );
199 $formatter = $this->createMock( \Monolog\Formatter\FormatterInterface::class );
200 $formatter->expects( $this->
any() )
202 ->will( $this->onConsecutiveCalls(
'words',
null,
'lines' ) );
205 $handler->setFormatter( $formatter );
209 'level' => Logger::EMERGENCY,
215 'level' => Logger::EMERGENCY,
221 'level' => Logger::EMERGENCY,
they could even be mouse clicks or menu items whatever suits your program You should also get your if any
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same so they can t rely on Unix and must forbid reads to even standard directories like tmp lest users read each others files We cannot assume that the user has the ability to install or run any programs not written as web accessible PHP scripts Since anything that works on cheap shared hosting will work if you have shell or root access MediaWiki s design is based around catering to the lowest common denominator Although we support higher end setups as the way many things work by default is tailored toward shared hosting These defaults are unconventional from the point of view of and they certainly aren t ideal for someone who s installing MediaWiki as MediaWiki does not conform to normal Unix filesystem layout Hopefully we ll offer direct support for standard layouts in the but for now *any change to the location of files is unsupported *Moving things and leaving symlinks will *probably *not break anything
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves $handler
processing should stop and the error should be shown to the user * false