MediaWiki REL1_30
SearchIndexFieldTest.php
Go to the documentation of this file.
1<?php
2
8
9 public function getMergeCases() {
10 return [
11 [ 0, 'test', 0, 'test', true ],
14 [ 0, 'test', 0, 'test2', true ],
15 [ 0, 'test', 1, 'test', false ],
16 ];
17 }
18
27 public function testMerge( $t1, $n1, $t2, $n2, $result ) {
28 $field1 =
29 $this->getMockBuilder( SearchIndexFieldDefinition::class )
30 ->setMethods( [ 'getMapping' ] )
31 ->setConstructorArgs( [ $n1, $t1 ] )
32 ->getMock();
33 $field2 =
34 $this->getMockBuilder( SearchIndexFieldDefinition::class )
35 ->setMethods( [ 'getMapping' ] )
36 ->setConstructorArgs( [ $n2, $t2 ] )
37 ->getMock();
38
39 if ( $result ) {
40 $this->assertNotFalse( $field1->merge( $field2 ) );
41 } else {
42 $this->assertFalse( $field1->merge( $field2 ) );
43 }
44
45 $field1->setFlag( 0xFF );
46 $this->assertFalse( $field1->merge( $field2 ) );
47
48 $field1->setMergeCallback(
49 function ( $a, $b ) {
50 return "test";
51 }
52 );
53 $this->assertEquals( "test", $field1->merge( $field2 ) );
54 }
55
56}
Search SearchIndexFieldDefinition.
testMerge( $t1, $n1, $t2, $n2, $result)
getMergeCases
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
Definition hooks.txt:1976
processing should stop and the error should be shown to the user * false
Definition hooks.txt:187