Fix php code style
[lhc/web/wiklou.git] / tests / phpunit / includes / search / SearchIndexFieldTest.php
index ec046a7..bb7508c 100644 (file)
@@ -10,7 +10,7 @@ class SearchIndexFieldTest extends MediaWikiTestCase {
                return [
                        [ 0, 'test', 0, 'test', true ],
                        [ SearchIndexField::INDEX_TYPE_NESTED, 'test',
-                         SearchIndexField::INDEX_TYPE_NESTED, 'test', false ],
+                               SearchIndexField::INDEX_TYPE_NESTED, 'test', false ],
                        [ 0, 'test', 0, 'test2', true ],
                        [ 0, 'test', 1, 'test', false ],
                ];
@@ -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 ) );
        }
+
 }