4 * @author Adam Shorland
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', array( '__toString' ) );
22 $mockToStringObj->expects( $this->any() )
23 ->method( '__toString' )
24 ->will( $this->returnValue( '{STRING_OBJ_VAL}' ) );
28 $this->getMockJob( false ),
32 $this->getMockJob( array( 'key' => 'val' ) ),
36 $this->getMockJob( array( 'key' => array( 'inkey' => 'inval' ) ) ),
37 'someCommand key={"inkey":"inval"}'
40 $this->getMockJob( array( 'val1' ) ),
44 $this->getMockJob( array( 'val1', 'val2' ) ),
45 'someCommand 0=val1 1=val2'
48 $this->getMockJob( array( new stdClass() ) ),
49 'someCommand 0=object(stdClass)'
52 $this->getMockJob( array( $mockToStringObj ) ),
53 'someCommand 0={STRING_OBJ_VAL}'
58 public function getMockJob( $params ) {
59 $mock = $this->getMockForAbstractClass(
61 array( 'someCommand', new Title(), $params ),