MediaWiki REL1_33
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}
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
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:2004
processing should stop and the error should be shown to the user * false
Definition hooks.txt:187