Reset WatchedItemStore default instance after tests
authoraddshore <addshorewiki@gmail.com>
Tue, 15 Mar 2016 00:12:06 +0000 (00:12 +0000)
committeraddshore <addshorewiki@gmail.com>
Tue, 15 Mar 2016 15:36:38 +0000 (15:36 +0000)
commit3ab9a9656c2c8fd163dbcbe34fb017e0db4af20b
tree86e4c5c0ec03f9c6bb4b47d157d837d0ac428864
parent47d7f45f87e583b8df3d0a602c44f70842e6c261
Reset WatchedItemStore default instance after tests

Prior to this change in tests the overridden store
would remain in the instance static and thus could
be used in other places.

This patch introduces the used of ScopedCallbacks
in the override methods in WatchedItemStore.
This means that any instance of WatchedItemStore
should return to a regular state after each test.

This is better than requiring the tests to reset
the value back to the origional as this would likely
be forgotten and result in long hunts for failing
tests.

This was found while writing more tests...

Change-Id: I9aa71425642174ae9ea2c6d4f85dcd07d724af11
includes/WatchedItemStore.php
tests/phpunit/includes/WatchedItemStoreUnitTest.php
tests/phpunit/includes/WatchedItemUnitTest.php