Middleware on CakePHP

hi, i want to ask question about middleware on cakephp. Because i want to take out isAuthorize from my controller, i’m wanting to put it on middleware.
i’ve create the usermiddleware, and it can read the request and the session when i open the page on browser.

my question is, my unit testing in controller which has set the session is not readed on middleware, i’ve also do Session::write on unit test, it still can’t read on middleware,

to sum it: how can i make unit test for middleware which read session?
thx in advance