public function testGetState() { $state = $this->_model->getState(); $this->assertInstanceOf('Mage_Catalog_Model_Layer_State', $state); $this->assertSame($state, $this->_model->getState()); $state = new Mage_Catalog_Model_Layer_State(); $this->_model->setState($state); // $this->_model->setData('state', state); $this->assertSame($state, $this->_model->getState()); }
/** * Prepare price filter model * * @param Magento_Test_Request|null $request * @return void */ protected function _prepareFilter($request = null) { $layer = new Mage_Catalog_Model_Layer(); $layer->setCurrentCategory(4); $layer->setState(new Mage_Catalog_Model_Layer_State()); $filter = new Mage_Catalog_Model_Layer_Filter_Price(); $filter->setLayer($layer)->setAttributeModel(new Varien_Object(array('attribute_code' => 'price'))); if (!is_null($request)) { $filter->apply($request, new Mage_Core_Block_Text()); $interval = $filter->getInterval(); if ($interval) { $this->_model->setLimits($interval[0], $interval[1]); } } $collection = $layer->getProductCollection(); $this->_model->setPricesModel($filter)->setStatistics($collection->getMinPrice(), $collection->getMaxPrice(), $collection->getPriceStandardDeviation(), $collection->getSize()); }