@
@
@Twitt2021-06-16 13:44:31
PHPUnit
@Twitt, 2021-06-16 13:44:31

How to lock the session with the desired values?

$session = \Mockery::mock(\Symfony\Component\HttpFoundation\Session\Session::class);


Here I get a mock session. But I would like to set the necessary values ​​\u200b\u200bin it, but for example, when I do this:
$session->shouldReceive('set', 'all', 'get')->once()->andReturnSelf();
$session->set('myKey', 'myValue');

then everything goes fine, but when I do $session->get('myKey'), then it returns me a Mockery object, instead of the expected myValue

Most likely I'm doing something wrong, maybe someone knows how to do it right ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question