createMock( Title::class ); $mock->expects( $this->any() )->method( 'getLatestRevID' )->willReturn( $revId ); $mock->expects( $this->any() )->method( 'getArticleID' )->willReturn( $articleId ); return $mock; } public function testRun() { $error = [ 'type' => 'fostered', 'location' => [ 0, 10 ], 'params' => [], 'dbid' => null, ]; $job = new RecordLintJob( $this->getMockTitle(), [ 'errors' => [ $error ], 'revision' => 2, ] ); $this->assertTrue( $job->run() ); /** @var LintError[] $errorsFromDb */ $errorsFromDb = array_values( ( new Database( 1 ) )->getForPage() ); $this->assertCount( 1, $errorsFromDb ); $this->assertInstanceOf( LintError::class, $errorsFromDb[0] ); $this->assertEquals( $error['type'], $errorsFromDb[0]->category ); $this->assertEquals( $error['location'], $errorsFromDb[0]->location ); $this->assertEquals( $error['params'], $errorsFromDb[0]->params ); } }