Fix output buffer error in phpunit>=4.2

Partial fix for #1262
Need improve exception handling. For now we are losing a stack trace and exception's class.
What do you mean on "top level code"?
Code in Yii or in Codeception or PHPUnit?