MediaWiki REL1_33
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}
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
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 When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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:921