wiki.techinc.nl/includes/deferred/MergeableUpdate.php
Timo Tijhof 31c461e75e deferred: Improve DeferredUpdates test coverage
From 1% of lines to 12% in deferred/.
From 6% of lines to 68% in DeferredUpdates.php.

* Adding relevant @covers tags to existing tests.
* Add coverage for MWCallableUpdate.
* Add coverage for MergeableUpdate.

Also:
* Make MergeableUpdate extend DeferrableUpdate.
  1. Because PHPUnit doesn't support implementing multiple interfaces
     in a mock, and would make the mock fail the typehint at run-time.
  2. It DeferredUpdates doesn't support having a MergeableUpdate that isn't
     itself a DeferrableUpdate given the only way to reach that code is past
     methods that are type-hinted with DeferrableUpdate.
  3. Making the interface extend DeferrableUpdate helps produce better and
     earlier errors. Instead of run-time error:
     > Argument 1 passed to addUpdate() must implement interface DeferrableUpdate
     > instance of MergeableUpdate given
     We get:
     > Fatal error: Class .. contains 1 abstract method and must therefore be
     > declared abstract or implement the remaining methods (doUpdate)

Change-Id: Ie384bf849a96bb37dc3e4a4154da2b02889e9fc8
2017-10-12 21:18:12 +01:00

16 lines
410 B
PHP

<?php
/**
* Interface that deferrable updates can implement. DeferredUpdates uses this to merge
* all pending updates of PHP class into a single update by calling merge().
*
* @since 1.27
*/
interface MergeableUpdate extends DeferrableUpdate {
/**
* Merge this update with $update
*
* @param MergeableUpdate $update Update of the same class type
*/
function merge( MergeableUpdate $update );
}