public function testApply() { $priceId = '15-50'; $requestVar = 'test_request_var'; $this->target->setRequestVar($requestVar); $this->request->expects($this->exactly(1))->method('getParam')->will($this->returnCallback(function ($field) use($requestVar, $priceId) { $this->assertTrue(in_array($field, [$requestVar, 'id'])); return $priceId; })); $this->fulltextCollection->expects($this->once())->method('addFieldToFilter')->with('price')->will($this->returnSelf()); $this->target->apply($this->request); }