Fix MiddleWare registration and execution.

* Only SecurityMiddleware was registered. All others failed silently because they were just added to an array that wasn't used.
* Execute tests in the same order they were registered. The AppFramework **app** runs `afterException` in reverse order as how the middleware was registered. That meant that a controller method which should **not** run was executed **before** SecurityMiddleware kicked in!
* Removed unused counter in MiddlewareDispatcher.
* White-space fixes.

Testing the difference is a bit difficult, because before this patch SecurityMiddleware was the only one registered, so it actually worked. After this patch other middleware layers can get registered and will run after SecurityMiddleware.

@DeepDiver1975 @Raydiation @karlitschek