Fix watchlist hook query in the client

In fixing this, a new hook handler is added and more tests.

The problem was that core was changed to add quotes around
the RC type values, and then wikibase was not matching the
where condition in a consistent way.

Here, we use makeList() which adds quotes, and compare the
where conditions, to modify the rc_type condition to include
Wikibase "external" changes if watchlist is to show them.
We exclude external rc_type if watchlist is to hide them.

Further improvement in future patches could change
the code to make more use of FormOptions and share code
with recent changes options handling. (see bug 62798)

Bug: 62149
Change-Id: I672bedc673736d36a29161cfe116b5df021ff5b8
(cherry picked from commit b10dbab9fa0cfb86c254288ae6b8148d4db7f238)
Handle InvalidArgumentException in ClaimHtmlGenerator

(see also bug: 62495 to get this fixed more nicely in Wikibase master)

Bug: 61915
Change-Id: I5e623450a4468f9fc31cf7a85b39f6d812723a98
(cherry picked from commit b9aea256ba7a91fffb2c8c52a25a4e18dede2b91)
Merge "Fix watchlist hook query in the client" into mw1.23-wmf19
Merge "Handle InvalidArgumentException in ClaimHtmlGenerator" into mw1.23-wmf19