fix issues #2897
Add test to prove the fix made in pull/2899

Ensure that event listeners are not lost when merging the global and
local listeners.

Fixes #2897
Fixes #2899
Merge branch 'issue-2897' into 2.5

Merge pull request #2899 into 2.5 to fix issues with event dispatching.
Merge branch '2.5' of github.com:cakephp/cakephp into 2.5