Fix problems with static variable caches in PHPUnit

The resetAfterTest() does not purge static variable caches (indeed). The
patch disables these caches in PHPUnit tests and fixes some regressions
of such a step.
MDLSITE-2157 Add the auto-merge feature
MDLSITE-2157 Allow reports for auto-merge results
MDLSITE-2157 Add a CLI automerge utility

This is intended for the initial execution and for cron jobs.
MDLSITE-2157 Execute auto-merge after the stage commit and strings import