createMock( DBConnRef::class ); $localDB->expects( $this->once() )->method( 'update' )->with( 'abuse_filter', [ 'af_hit_count=af_hit_count+1' ], [ 'af_id' => $localFilters ] ); $lb = $this->createMock( ILoadBalancer::class ); $lb->method( 'getConnectionRef' )->willReturn( $localDB ); $globalDB = $this->createMock( IDatabase::class ); $globalDB->expects( $this->once() )->method( 'update' )->with( 'abuse_filter', [ 'af_hit_count=af_hit_count+1' ], [ 'af_id' => $globalFilters ] ); $centralDBManager = $this->createMock( CentralDBManager::class ); $centralDBManager->method( 'getConnection' )->willReturn( $globalDB ); $watcher = new UpdateHitCountWatcher( $lb, $centralDBManager ); $watcher->run( $localFilters, $globalFilters, 'default' ); // Two soft assertions done above $this->addToAssertionCount( 2 ); } }