MDL-37350 Detach listeners when hiding the 'Add roles' popup

If the submit event listener is not correctly closed, then the submit event
calls the relevant callback multiple times incorrectly.

When hiding the Add role dialogue, we need to detach any event listeners
which are applied to it.
MDL-36881 Handle poorly behaved modname_get_types functions better

The modname_get_types function is not always well implemented by
third-party plugins and some return poor data. This in turn leads to
incorrect module definitions, and can lead to problems in both the
'Add an activity...' dropdowns and the Activity chooser.

This will also prevent display of plugins which legitimately can have
subtypes but where no subtypes were found. Since such plugins cannot be
used in this fashion in any case, this is also beneficial.

Signed-off-by: Andrew Robert Nicols <andrew.nicols@lancaster.ac.uk>
MDL-34671 Stop browser receiving escape keydown in modal dialogues

In certain modal dialogues, we listen on the Escape key to close a
dialogue. However, this is still passed to the browser. As a result, if the
browser is in full screen mode and that browser respects the escape key as
a means to exit full screen.

As a result, we need to ensure that we listen for the escape key at keydown
rather than keyup, and additionally prevent the default browser behaviour.

This is a workaround to http://yuilibrary.com/projects/yui3/ticket/2532616
and, should that issue be fixed, it should be removed.
MDL-37668 Accessibility: Help popup should be easy to close using keyboard
MDL-37596 optionally enable CLI maintenance later
MDL-37086 phpunit: use alt reset method.

When code executed in test cases is using/preventing
database transactions, phpunit itself cannot
use transactions for reseting between cases. But we
can tell it about, so some alternative (and slower)
method for reseting will be used.
Merge branch 'wip-MDL-37545-m25' of git://github.com/samhemelryk/moodle
Merge branch 'master_MDL-34231' of git://github.com/danmarsden/moodle
Merge branch 'MDL-37668-master' of git://github.com/sammarshallou/moodle
Merge branch 'MDL-34671-m' of git://github.com/andrewnicols/moodle
Merge branch 'w04_MDL-37596_m25_schedmaint' of git://github.com/skodak/moodle
Merge branch 'MDL-36881-m' of git://github.com/andrewnicols/moodle
Merge branch 'MDL-37350-m' of git://github.com/andrewnicols/moodle
Merge branch 'MDL-37697-m' of git://github.com/andrewnicols/moodle
Merge branch 'master_MDL-37696' of git://github.com/danmarsden/moodle
Merge branch 'wip-mdl-36619' of git://github.com/rajeshtaneja/moodle
Merge branch 'wip-MDL-37474-m25' of git://github.com/samhemelryk/moodle
Merge branch 'w04_MDL-37718_m25_rs' of git://github.com/skodak/moodle
MDL-37046 behat: Behat admin tool skeleton
MDL-37046 behat: Basic web execution wrapper