Answer the question
In order to leave comments, you need to log in
Create mock Request?
$request = $this->createMock(Request::class);
$request->request = $this->createMock(ParameterBag::class);
$request->request->set('mykey', 'myvalue');
dump($request->request); //параметры пустые
$filter = UserFilter::fromRequest($request); // сюда надо передать праметры mykey
Answer the question
In order to leave comments, you need to log in
$request = $this->createMock(Request::class);
$request->request = $this->createMock(ParameterBag::class);
$request->request->method('get')->will($this->returnValueMap([
[ 'key1', null, 'value1' ],
[ 'key2', null, 'value2' ],
[ 'key3', null, 'value3' ],
[ 'key4', null, 'value4' ],
]));
$this->assertEquals('value3', $request->request->get('key3'));
$request = new Request();
$request->request->set('key1', 'value1');
$request->request->set('key2', 'value2');
$request->request->set('key3', 'value3');
$request->request->set('key4', 'value4');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question