6 class JobTest
extends MediaWikiTestCase
{
9 * @dataProvider provideTestToString
12 * @param string $expected
14 * @covers Job::toString
16 public function testToString( $job, $expected ) {
17 $this->assertEquals( $expected, $job->toString() );
20 public function provideTestToString() {
21 $mockToStringObj = $this->getMock( 'stdClass', [ '__toString' ] );
22 $mockToStringObj->expects( $this->any() )
23 ->method( '__toString' )
24 ->will( $this->returnValue( '{STRING_OBJ_VAL}' ) );
28 $this->getMockJob( false ),
32 $this->getMockJob( [ 'key' => 'val' ] ),
36 $this->getMockJob( [ 'key' => [ 'inkey' => 'inval' ] ] ),
37 'someCommand key={"inkey":"inval"}'
40 $this->getMockJob( [ 'val1' ] ),
44 $this->getMockJob( [ 'val1', 'val2' ] ),
45 'someCommand 0=val1 1=val2'
48 $this->getMockJob( [ new stdClass() ] ),
49 'someCommand 0=object(stdClass)'
52 $this->getMockJob( [ $mockToStringObj ] ),
53 'someCommand 0={STRING_OBJ_VAL}'
63 "rootJobSignature" => "45868e99bba89064e4483743ebb9b682ef95c1a7",
64 "rootJobTimestamp" => "20160309110158",
66 "file" => "db1023-bin.001288",
68 "asOfTime" => 1457521464.3814
70 "triggeredRecursive" => true
72 'someCommand pages={"932737":[0,"Robert_James_Waller"]} ' .
73 'rootJobSignature=45868e99bba89064e4483743ebb9b682ef95c1a7 ' .
74 'rootJobTimestamp=20160309110158 masterPos=' .
75 '{"file":"db1023-bin.001288","pos":"308257743","asOfTime":1457521464.3814} ' .
76 'triggeredRecursive=1'
81 public function getMockJob( $params ) {
82 $mock = $this->getMockForAbstractClass(
84 [ 'someCommand', new Title(), $params ],