MediaWiki REL1_31
FileContentHandlerTest.php
Go to the documentation of this file.
1<?php
2
12 private $handler;
13
14 protected function setUp() {
15 parent::setUp();
16
17 $this->handler = new FileContentHandler();
18 }
19
20 public function testIndexMapping() {
21 $mockEngine = $this->createMock( SearchEngine::class );
22
23 $mockEngine->expects( $this->atLeastOnce() )
24 ->method( 'makeSearchFieldMapping' )
25 ->willReturnCallback( function ( $name, $type ) {
26 $mockField =
27 $this->getMockBuilder( SearchIndexFieldDefinition::class )
28 ->setMethods( [ 'getMapping' ] )
29 ->setConstructorArgs( [ $name, $type ] )
30 ->getMock();
31 return $mockField;
32 } );
33
34 $map = $this->handler->getFieldsForSearchIndex( $mockEngine );
35 $expect = [
36 'file_media_type' => 1,
37 'file_mime' => 1,
38 'file_size' => 1,
39 'file_width' => 1,
40 'file_height' => 1,
41 'file_bits' => 1,
42 'file_resolution' => 1,
43 'file_text' => 1,
44 ];
45 foreach ( $map as $name => $field ) {
46 $this->assertInstanceOf( SearchIndexField::class, $field );
47 $this->assertEquals( $name, $field->getName() );
48 unset( $expect[$name] );
49 }
50 $this->assertEmpty( $expect );
51 }
52}
Content handler for File: files TODO: this handler s not used directly now, but instead manually call...
Base class that store and restore the Language objects.
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 set to a MediaTransformOutput the error message to be returned in an array you should do so by altering $wgNamespaceProtection and $wgNamespaceContentModels outside the handler
Definition hooks.txt:930