From f6d65e533c62f6deb21342d4901ece24497b433e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 4 Jun 2015 07:31:04 +0200 Subject: Update to MediaWiki 1.25.1 --- tests/phpunit/includes/jobqueue/JobTest.php | 67 +++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 tests/phpunit/includes/jobqueue/JobTest.php (limited to 'tests/phpunit/includes/jobqueue/JobTest.php') diff --git a/tests/phpunit/includes/jobqueue/JobTest.php b/tests/phpunit/includes/jobqueue/JobTest.php new file mode 100644 index 00000000..93069d2e --- /dev/null +++ b/tests/phpunit/includes/jobqueue/JobTest.php @@ -0,0 +1,67 @@ +assertEquals( $expected, $job->toString() ); + } + + public function provideTestToString() { + $mockToStringObj = $this->getMock( 'stdClass', array( '__toString' ) ); + $mockToStringObj->expects( $this->any() ) + ->method( '__toString' ) + ->will( $this->returnValue( '{STRING_OBJ_VAL}' ) ); + + return array( + array( + $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}' + ), + ); + } + + public function getMockJob( $params ) { + $mock = $this->getMockForAbstractClass( + 'Job', + array( 'someCommand', new Title(), $params ), + 'SomeJob' + ); + return $mock; + } + +} -- cgit v1.2.3-54-g00ecf