MediaWiki REL1_31
TextContentHandlerTest.php
Go to the documentation of this file.
1<?php
2
10 public function testSupportsDirectEditing() {
12 $this->assertTrue( $handler->supportsDirectEditing(), 'direct editing is supported' );
13 }
14
19 public function testFieldsForIndex() {
21
22 $mockEngine = $this->createMock( SearchEngine::class );
23
24 $mockEngine->expects( $this->atLeastOnce() )
25 ->method( 'makeSearchFieldMapping' )
26 ->willReturnCallback( function ( $name, $type ) {
27 $mockField =
28 $this->getMockBuilder( SearchIndexFieldDefinition::class )
29 ->setConstructorArgs( [ $name, $type ] )
30 ->getMock();
31 $mockField->expects( $this->atLeastOnce() )->method( 'getMapping' )->willReturn( [
32 'testData' => 'test',
33 'name' => $name,
34 'type' => $type,
35 ] );
36 return $mockField;
37 } );
38
42 $fields = $handler->getFieldsForSearchIndex( $mockEngine );
43 $mappedFields = [];
44 foreach ( $fields as $name => $field ) {
45 $this->assertInstanceOf( SearchIndexField::class, $field );
49 $mappedFields[$name] = $field->getMapping( $mockEngine );
50 }
51 $this->assertArrayHasKey( 'language', $mappedFields );
52 $this->assertEquals( 'test', $mappedFields['language']['testData'] );
53 $this->assertEquals( 'language', $mappedFields['language']['name'] );
54 }
55}
Base class that store and restore the Language objects.
testFieldsForIndex()
SearchEngine::makeSearchFieldMapping ContentHandler::getFieldsForSearchIndex.
testSupportsDirectEditing()
TextContentHandler::supportsDirectEditing.
Base content handler implementation for flat text contents.
Allows to change the fields on the form that will be generated $name
Definition hooks.txt:302
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
Definition hooks.txt:903