deferred: Improve DeferredUpdates test coverage
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 12 Oct 2017 18:58:33 +0000 (19:58 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 12 Oct 2017 20:18:12 +0000 (21:18 +0100)
commit31c461e75e4265b55e30844102136b6dc35ee32a
treeff3336c2591b321ad586664468023857a433ca7d
parentfd77f4f95a20eacf40717bd3eacb940089dd62e5
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
includes/deferred/MergeableUpdate.php
tests/phpunit/includes/deferred/CdnCacheUpdateTest.php
tests/phpunit/includes/deferred/DeferredUpdatesTest.php
tests/phpunit/includes/deferred/MWCallableUpdateTest.php [new file with mode: 0644]