Added release notes for 'ContentHandler::runLegacyHooks' removal
[mediawiki.git] / tests / phpunit / includes / search / SearchIndexFieldTest.php
blobec046a767f4fa0ada4d29321cc1b66cad831c904
1 <?php
3 /**
4 * @group Search
5 * @covers SearchIndexFieldDefinition
6 */
7 class SearchIndexFieldTest extends MediaWikiTestCase {
9 public function getMergeCases() {
10 return [
11 [ 0, 'test', 0, 'test', true ],
12 [ SearchIndexField::INDEX_TYPE_NESTED, 'test',
13 SearchIndexField::INDEX_TYPE_NESTED, 'test', false ],
14 [ 0, 'test', 0, 'test2', true ],
15 [ 0, 'test', 1, 'test', false ],
19 /**
20 * @dataProvider getMergeCases
22 public function testMerge( $t1, $n1, $t2, $n2, $result ) {
23 $field1 = $this->getMockBuilder( 'SearchIndexFieldDefinition' )
24 ->setMethods( [ 'getMapping' ] )
25 ->setConstructorArgs( [ $n1, $t1 ] )->getMock();
26 $field2 = $this->getMockBuilder( 'SearchIndexFieldDefinition' )
27 ->setMethods( [ 'getMapping' ] )
28 ->setConstructorArgs( [ $n2, $t2 ] )->getMock();
30 if ( $result ) {
31 $this->assertNotFalse( $field1->merge( $field2 ) );
32 } else {
33 $this->assertFalse( $field1->merge( $field2 ) );
36 $field1->setFlag( 0xFF );
37 $this->assertFalse( $field1->merge( $field2 ) );