5 * @covers SearchIndexFieldDefinition
7 class SearchIndexFieldTest
extends MediaWikiTestCase
{
9 public function getMergeCases() {
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 ],
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();
31 $this->assertNotFalse( $field1->merge( $field2 ) );
33 $this->assertFalse( $field1->merge( $field2 ) );
36 $field1->setFlag( 0xFF );
37 $this->assertFalse( $field1->merge( $field2 ) );