Merge "TableDiffFormatter: Don't repeatedly call array_shift()"
[lhc/web/wiklou.git] / tests / phpunit / includes / jobqueue / JobTest.php
index 0550a93..600a36f 100644 (file)
@@ -18,47 +18,73 @@ class JobTest extends MediaWikiTestCase {
        }
 
        public function provideTestToString() {
-               $mockToStringObj = $this->getMock( 'stdClass', array( '__toString' ) );
+               $mockToStringObj = $this->getMock( 'stdClass', [ '__toString' ] );
                $mockToStringObj->expects( $this->any() )
                        ->method( '__toString' )
                        ->will( $this->returnValue( '{STRING_OBJ_VAL}' ) );
 
-               return array(
-                       array(
+               $requestId = 'requestId=' . WebRequest::getRequestId();
+
+               return [
+                       [
                                $this->getMockJob( false ),
-                               'someCommand '
-                       ),
-                       array(
-                               $this->getMockJob( array( 'key' => 'val' ) ),
-                               'someCommand  key=val'
-                       ),
-                       array(
-                               $this->getMockJob( array( 'key' => array( 'inkey' => 'inval' ) ) ),
-                               'someCommand  key={"inkey":"inval"}'
-                       ),
-                       array(
-                               $this->getMockJob( array( 'val1' ) ),
-                               'someCommand  0=val1'
-                       ),
-                       array(
-                               $this->getMockJob( array( 'val1', 'val2' ) ),
-                               'someCommand  0=val1 1=val2'
-                       ),
-                       array(
-                               $this->getMockJob( array( new stdClass() ) ),
-                               'someCommand  0=object(stdClass)'
-                       ),
-                       array(
-                               $this->getMockJob( array( $mockToStringObj ) ),
-                               'someCommand  0={STRING_OBJ_VAL}'
-                       ),
-               );
+                               'someCommand  ' . $requestId
+                       ],
+                       [
+                               $this->getMockJob( [ 'key' => 'val' ] ),
+                               'someCommand  key=val ' . $requestId
+                       ],
+                       [
+                               $this->getMockJob( [ 'key' => [ 'inkey' => 'inval' ] ] ),
+                               'someCommand  key={"inkey":"inval"} ' . $requestId
+                       ],
+                       [
+                               $this->getMockJob( [ 'val1' ] ),
+                               'someCommand  0=val1 ' . $requestId
+                       ],
+                       [
+                               $this->getMockJob( [ 'val1', 'val2' ] ),
+                               'someCommand  0=val1 1=val2 ' . $requestId
+                       ],
+                       [
+                               $this->getMockJob( [ new stdClass() ] ),
+                               'someCommand  0=object(stdClass) ' . $requestId
+                       ],
+                       [
+                               $this->getMockJob( [ $mockToStringObj ] ),
+                               'someCommand  0={STRING_OBJ_VAL} ' . $requestId
+                       ],
+                       [
+                               $this->getMockJob( [
+                                       "pages" => [
+                                               "932737" => [
+                                                       0,
+                                                       "Robert_James_Waller"
+                                               ]
+                                       ],
+                                       "rootJobSignature" => "45868e99bba89064e4483743ebb9b682ef95c1a7",
+                                       "rootJobTimestamp" => "20160309110158",
+                                       "masterPos" => [
+                                               "file" => "db1023-bin.001288",
+                                               "pos" => "308257743",
+                                               "asOfTime" => 1457521464.3814
+                                       ],
+                                       "triggeredRecursive" => true
+                               ] ),
+                               'someCommand  pages={"932737":[0,"Robert_James_Waller"]} ' .
+                               'rootJobSignature=45868e99bba89064e4483743ebb9b682ef95c1a7 ' .
+                               'rootJobTimestamp=20160309110158 masterPos=' .
+                               '{"file":"db1023-bin.001288","pos":"308257743","asOfTime":1457521464.3814} ' .
+                               'triggeredRecursive=1 ' .
+                               $requestId
+                       ],
+               ];
        }
 
        public function getMockJob( $params ) {
                $mock = $this->getMockForAbstractClass(
                        'Job',
-                       array( 'someCommand', new Title(), $params ),
+                       [ 'someCommand', new Title(), $params ],
                        'SomeJob'
                );
                return $mock;