/** * @return Decimal */ public function testApply() { /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var $request \Magento\TestFramework\Request */ $request = $objectManager->get('Magento\\TestFramework\\Request'); $request->setParam('decimal', '1-100'); $this->_model->apply($request); return $this->_model; }
public function testApply() { $filter = '10-150'; $requestVar = 'test_request_var'; $this->target->setRequestVar($requestVar); $this->request->expects($this->exactly(1))->method('getParam')->will($this->returnCallback(function ($field) use($requestVar, $filter) { $this->assertTrue(in_array($field, [$requestVar, 'id'])); return $filter; })); $attributeCode = 'AttributeCode'; $this->attribute->expects($this->any())->method('getAttributeCode')->will($this->returnValue($attributeCode)); $this->fulltextCollection->expects($this->once())->method('addFieldToFilter')->with($attributeCode)->will($this->returnSelf()); $this->target->apply($this->request); }