Move ResultWrapper subclasses to Rdbms
[mediawiki.git] / tests / phpunit / includes / search / SearchIndexFieldTest.php
blob9c10e499764c553cb65a7d69953d650dfc3e2da2
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 ) );