MediaWiki REL1_30
TextContentHandlerTest.php
Go to the documentation of this file.
1<?php
2
7 public function testSupportsDirectEditing() {
9 $this->assertTrue( $handler->supportsDirectEditing(), 'direct editing is supported' );
10 }
11
16 public function testFieldsForIndex() {
18
19 $mockEngine = $this->createMock( 'SearchEngine' );
20
21 $mockEngine->expects( $this->atLeastOnce() )
22 ->method( 'makeSearchFieldMapping' )
23 ->willReturnCallback( function ( $name, $type ) {
24 $mockField =
25 $this->getMockBuilder( 'SearchIndexFieldDefinition' )
26 ->setConstructorArgs( [ $name, $type ] )
27 ->getMock();
28 $mockField->expects( $this->atLeastOnce() )->method( 'getMapping' )->willReturn( [
29 'testData' => 'test',
30 'name' => $name,
31 'type' => $type,
32 ] );
33 return $mockField;
34 } );
35
39 $fields = $handler->getFieldsForSearchIndex( $mockEngine );
40 $mappedFields = [];
41 foreach ( $fields as $name => $field ) {
42 $this->assertInstanceOf( 'SearchIndexField', $field );
46 $mappedFields[$name] = $field->getMapping( $mockEngine );
47 }
48 $this->assertArrayHasKey( 'language', $mappedFields );
49 $this->assertEquals( 'test', $mappedFields['language']['testData'] );
50 $this->assertEquals( 'language', $mappedFields['language']['name'] );
51 }
52}
Base class that store and restore the Language objects.
testFieldsForIndex()
SearchEngine::makeSearchFieldMapping ContentHandler::getFieldsForSearchIndex.
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:901