X-Git-Url: http://git.cyclocoop.org/%27.parametre_url%28%20%20%20generer_action_auteur%28%27charger_plugin%27%2C%20%27update_flux%27%29%2C%27update_flux%27%2C%20%27oui%27%29.%27?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fsearch%2FSearchIndexFieldTest.php;h=bb7508c1c8a45747816a00e84def3d2d53e200fe;hb=54c56da85a33ce18582b7b6023f9e93181334a34;hp=9c10e499764c553cb65a7d69953d650dfc3e2da2;hpb=ecdef925bb0da8cfefbe2a72413a680edf732d31;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/search/SearchIndexFieldTest.php b/tests/phpunit/includes/search/SearchIndexFieldTest.php index 9c10e49976..bb7508c1c8 100644 --- a/tests/phpunit/includes/search/SearchIndexFieldTest.php +++ b/tests/phpunit/includes/search/SearchIndexFieldTest.php @@ -18,14 +18,23 @@ class SearchIndexFieldTest extends MediaWikiTestCase { /** * @dataProvider getMergeCases + * @param $t1 + * @param $n1 + * @param $t2 + * @param $n2 + * @param $result */ public function testMerge( $t1, $n1, $t2, $n2, $result ) { - $field1 = $this->getMockBuilder( 'SearchIndexFieldDefinition' ) - ->setMethods( [ 'getMapping' ] ) - ->setConstructorArgs( [ $n1, $t1 ] )->getMock(); - $field2 = $this->getMockBuilder( 'SearchIndexFieldDefinition' ) - ->setMethods( [ 'getMapping' ] ) - ->setConstructorArgs( [ $n2, $t2 ] )->getMock(); + $field1 = + $this->getMockBuilder( SearchIndexFieldDefinition::class ) + ->setMethods( [ 'getMapping' ] ) + ->setConstructorArgs( [ $n1, $t1 ] ) + ->getMock(); + $field2 = + $this->getMockBuilder( SearchIndexFieldDefinition::class ) + ->setMethods( [ 'getMapping' ] ) + ->setConstructorArgs( [ $n2, $t2 ] ) + ->getMock(); if ( $result ) { $this->assertNotFalse( $field1->merge( $field2 ) ); @@ -35,5 +44,13 @@ class SearchIndexFieldTest extends MediaWikiTestCase { $field1->setFlag( 0xFF ); $this->assertFalse( $field1->merge( $field2 ) ); + + $field1->setMergeCallback( + function ( $a, $b ) { + return "test"; + } + ); + $this->assertEquals( "test", $field1->merge( $field2 ) ); } + }