Beispiel #1
0
 protected function setUp()
 {
     $this->_helper = new Mage_Catalog_Helper_Product_View();
     $request = new Mage_Test_Controller_Request_Http();
     $request->setRouteName('catalog')->setControllerName('product')->setActionName('view');
     $this->_controller = new Mage_Catalog_ProductController($request, new Mage_Test_Controller_Response_Http());
 }
Beispiel #2
0
 public function testApply()
 {
     $request = new Mage_Test_Controller_Request_Http();
     $request->setParam('decimal', '1,100');
     $this->_model->apply($request, new Mage_Core_Block_Text());
     $this->assertEquals(100, $this->_model->getData('range'));
 }
Beispiel #3
0
 public function testApply()
 {
     $this->assertEmpty($this->_model->getLayer()->getState()->getFilters());
     $request = new Mage_Test_Controller_Request_Http();
     $request->setParam('attribute', $this->_attributeOptionId);
     $this->_model->apply($request, new Mage_Core_Block_Text());
     $this->assertNotEmpty($this->_model->getLayer()->getState()->getFilters());
 }
Beispiel #4
0
 /**
  * @magentoDataFixture Mage/Catalog/_files/categories.php
  */
 public function testGetRemoveUrl()
 {
     Mage::app()->getRequest()->setRoutingInfo(array('requested_route' => 'x', 'requested_controller' => 'y', 'requested_action' => 'z'));
     $request = new Mage_Test_Controller_Request_Http();
     $request->setParam('cat', 4);
     $this->_model->getFilter()->apply($request, new Mage_Core_Block_Text());
     $this->assertStringEndsWith('/x/y/z/?cat=3', $this->_model->getRemoveUrl());
 }
 public function testWithLimits()
 {
     $this->markTestIncomplete('Bug MAGE-6561');
     $request = new Mage_Test_Controller_Request_Http();
     $request->setParam('price', '10-100');
     $this->_prepareFilter($request);
     $this->assertEquals(array(0 => array('from' => 10, 'to' => 20, 'count' => 2), 1 => array('from' => 20, 'to' => 100, 'count' => 2)), $this->_model->calculateSeparators());
 }
Beispiel #6
0
 public function testApply()
 {
     $request = new Mage_Test_Controller_Request_Http();
     $request->setParam('cat', 3);
     $this->_model->apply($request, new Mage_Core_Block_Text());
     /** @var $category Mage_Catalog_Model_Category */
     $category = Mage::registry('current_category_filter');
     $this->assertInstanceOf('Mage_Catalog_Model_Category', $category);
     $this->assertEquals(3, $category->getId());
     return $this->_model;
 }
Beispiel #7
0
 /**
  * @magentoConfigFixture current_store catalog/layered_navigation/price_range_calculation manual
  */
 public function testApplyManual()
 {
     $request = new Mage_Test_Controller_Request_Http();
     $request->setParam('price', '10-20');
     $this->_model->apply($request, new Mage_Core_Block_Text());
     $this->assertEquals(array(10, 20), $this->_model->getData('interval'));
 }
Beispiel #8
0
 /**
  * @magentoAppIsolation enabled
  */
 public function testDispatch()
 {
     if (headers_sent()) {
         $this->markTestSkipped('Can\' dispatch - headers already sent');
     }
     $request = new Mage_Test_Controller_Request_Http();
     $request->setDispatched();
     /* Area-specific controller is used because area must be known at the moment of loading the design */
     $this->_model = new Mage_Core_Controller_Front_Action($request, new Mage_Test_Controller_Request_Http());
     $this->_model->dispatch('not_exists');
     $this->assertFalse($request->isDispatched());
     $this->assertEquals('cms', $request->getModuleName());
     $this->assertEquals('index', $request->getControllerName());
     $this->assertEquals('noRoute', $request->getActionName());
 }